- This topic has 20 replies, 3 voices, and was last updated 1 month, 4 weeks ago by selva.
2021-09-21 at 10:40 am #44917
I’ve got some HTML which give me a Dropdown List of Object Codes I can choose (eg 324, 327, 330 etc).
When my user Selects an Object, how do I get that value?
I cannot find anything that’d accept that value. I am used to “On Click”, but there isn’t anything relating to a Select (from a List) that I can find in Puzzles.
If those codes were buttons, i.e. a button for each code, 324, 327, 330 etc, I’d know how to handle that in Puzzles, but this is for a LIST of Codes (around 100 codes long, so I cannot use 100 buttons in my interface!).
Please can someone help?
2021-09-21 at 10:54 am #44919
- This topic was modified 1 year, 6 months ago by jezuk.
You just need to use the ‘get prop’ puzzle under the HTML puzzles. Then pick ‘value’. Put the ID name of your HTML element in the element field.
If your drop down list is made in third party software, check the ‘in parent doc’ option as well.2021-09-21 at 11:06 am #44920
I’ve tried your suggestion.
I’m used to “On Event of Click…… do this….”.
So for your suggestion, I’m trying it with an If, i.e. “If….”Get Prop Value from elem “Profile” = “324”….then do this…..”
Should that work?
Or is it some other way?
Thanks for any further help you can give2021-09-21 at 11:21 am #44921
You just want to get the value from the drop down list when a user selects one of the codes right?2021-09-21 at 11:27 am #44922
Yes, and depending on what code they choose, I want to show that object.
So what I’d do is Hide everything in the scene, and then just “Show” just that object.
But first, I need to know what object has been selected.2021-09-21 at 11:28 am #44923
This is my bit of HTML
<option value=”300″ selected>300</option>
</select>2021-09-21 at 11:53 am #44926
Ok. So yes, get the value like mentioned before with the ‘get prop’ puzzle, then do ‘if this value = number then show this object’. So you will just have a lot of ‘else if’.2021-09-21 at 12:07 pm #44927
I’m VERY nearly there
I’m learning about Puzzles, and it seems that this process only getting executed once.
So what’s happening is, is that the If test is getting tested ONLY at the beginning, during the opening of that webpage, so it only ever tests once, sees the first option at the top of that list and that’s it.
So, if I choose another option off that list, it’s not doing anything.
It’s almost like I need a Do While loop (and put that If statement inside the Do While loop).
So, Do While ‘you’re on this page’, test this;
if the profile value is ….. show this,
if the profile value is……. show this product,.
Any ideas how I can just have my If statement tested all the time?
Many thanks for any help you can give me (you’ve helped me a lot and I’m very grateful !).2021-09-21 at 12:14 pm #44928
I’m very glad to help!
Oh I’m forgetting, you just need to use ‘On Event’ puzzle and pick ‘input’. And then put the ‘get property’ and ‘if’ puzzles in there.2021-09-21 at 12:15 pm #44929
I’ve put my If test into an “On Event of” and selected the “mouseleave”……
Seems to be working
Yay!2021-09-21 at 12:17 pm #44930
We typed at the same time Vern, so I’ve changed it to input
Many, many thanks, I’m sooooo chuffed that this is working! (thanks to you!)2021-09-21 at 12:19 pm #44931
You’re very welcome Jezuk! I’m very glad to know it’s working!2021-09-21 at 12:48 pm #44932
You’re a star Vern.
There’s only one ‘big’ problem……
With a 100 coded products, this will get very unwieldy…..
To do that, I’ll need a ultra nested If, Then, Else statement (been there before with Excel, I know this won’t work because it’s very, very easy to make a mistake and incredibly difficult to debug, I’ve been there……).
The solution is that software needs a Select statement in the Logic section of Puzzles.
If I’ve got a 100 codes, and it can only be any one of these 100 codes, I just want a ‘Select’ statement so that I can test;
When (“200”) do this….
When (“203”) do this…..
I’ve seen these in other packages, like I say, Excel, is very clunky because of this….
Dang!2021-09-21 at 1:51 pm #44936
Ok. There’s a way more efficient way, it’s just a little more complicated and deeper.
How are your objects named? (The objects in scene)2021-09-21 at 2:59 pm #44939
Name your scene objects in your modeling software after their corresponding number.
Then use a ‘find occurrence’ puzzle from Text. Then you can use a ‘for each’ puzzle from Loops to iterate through your list of scene objects to find the correct one.
- You must be logged in to reply to this topic.