We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Using target.id from parent doc as argument in procedure puzzle

Home Forums Puzzles Using target.id from parent doc as argument in procedure puzzle

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #48472
    Branden Coker
    Customer

    I’m running into an issue that I dealt with a few months ago, but was never able to resolve.

    I’d like to use the target.id of an element in my parent document as an argument in Verge puzzles.

    These puzzles work:
    works

    These do not:
    doesn't work

    When I attempt to replace the “availability” var with my target.id, it no longer works. The target.id I’m clicking in this example is indeed named exactly the same as the var in Verge puzzles, but it seems I’m missing something in the jump from parent doc to local (Verge) doc. Any help would be greatly appreciated.

    #48473
    Branden Coker
    Customer

    Images:

    Attachments:
    You must be logged in to view attached files.
    #48479
    Branden Coker
    Customer

    After digging around a bit more, I realized that the “variable value by name” puzzle may be the answer to my problem. I’ve managed to get this working, but now I’m running into another issue.

    This works:

    works

    While this works for all the elements in my parent HTML doc, when I attempt to use it with an element named “performance” I get unexpected results in the app and console.

    Normal output to the console with the above puzzle is a list of items from the corresponding variable. However when I attempt to use the “performance” element, I get this:

    console

    Looks like debug info, but I’m not sure where it’s coming from. The obvious workaround is to change my element ID to something other than “performance,” but that would affect a lot of different files on our end. Hoping there is another solution.

    Attachments:
    You must be logged in to view attached files.
    #48484
    Branden Coker
    Customer

    For clarity, this can be reproduced with the following puzzles:

    puzzles

    Attachments:
    You must be logged in to view attached files.
    #48490

    Hi Branden,

    Indeed, performance is a built-in global variable
    https://developer.mozilla.org/en-US/docs/Web/API/performance_property

    So when you name an HTML element as “performance”, it conflicts with the existing global variable, and that’s why the puzzle returns the original variable which is of no use for you.

    I suggest you try the following trick. Instead of using that variable value by name puzzle, you just add an empty Text value to the result of the get event property puzzle. See if it helps.

    Chief 3D Verger | LinkedIn | Twitter

    #48501
    Branden Coker
    Customer

    Yuri, thanks for the reply. Good to know regarding the built-in performance variable. I had no idea.

    As for adding empty text value to the target.id, what’s the best way to do that? I still need to be able to use this in a for loop puzzle.

    #48505

    you can just use that create text puzzle, with an empty value in the text puzzle

    Chief 3D Verger | LinkedIn | Twitter

    #48506
    Branden Coker
    Customer

    Not working for me. I can’t use the text puzzle in the loop input. I also tried reverting back to my original approach at the start of this thread. Couldn’t get this to work by passing the text block to an argument in a procedure either.

    Attachments:
    You must be logged in to view attached files.
    #48517

    Well what if you actually use a Text puzzle with empty string value rather than leave the slot empty? Just give it a try.

    Chief 3D Verger | LinkedIn | Twitter

    #48595
    Branden Coker
    Customer

    Hi Yuri, unfortunately, that’s not working either. I’m working around it now by using an if statement to single out the returned value of “performance.” A more elegant solution would certainly be welcome though.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.