Input value to a field (this should be simple...)

Newbie here

The aim is to provide the user with 2 options to enter data (number):

(1) Simply enter (type) the number (50) into the input field . No problems with this. It works.

(2) Click on an associated icon (image) which has a numerical value (50) and by doing so input that value into the field. I am not sure how to do this. Not sure if it must be a group or what but not able to get this working.

Suggestions please? TIA

Hi there, @megaphonepal… one way you can do what you described is by using a custom state. You could create a custom state, say, at the page level, and you could set the input element’s Initial content field to be the custom state. Then, when an icon/image is clicked, you would run a workflow to set the custom state to a numerical value, and that value would then automatically appear in the input. Make sense?

Hope this helps.

Best…
Mike

1 Like

Thanks Mike. Working on this slowly to understand what is going on and doing the tutorial. Will update you shortly on the outcome. Hopefully a success story :wink:

Cheers

1 Like

Hi again.

I have not been able to get it to work. This is what I have done so far:

(1) Created a custom state (“icon_value”) for the element (“50H Group”) with a default value of 50 - See image A

(2) Set state’s icon_value of 50H Group. Then set the value of 50H’s Group’s icon_value - See image B

… I suspect there is something wrong with the last part for ‘Set state value’. If nothing else, I have not found a way to instruct the workflow to enter the value (50) into the input field (“Input Head’s Number”)

This link on Evernote might make more sense of things:

Thanks
Pete

You’re close. :slight_smile:

In image A, remove the default value for the custom state. In image B, set the value to 50 (literally the number 50). Then, open the edit dialog for the input element that is supposed to show a value of 50 when the group is clicked, and set the Initial content field for that element to 50H Group's icon_value. At that point, you should be good to go.

1 Like

Hi Mike,

Issue:
By clicking on the 50 H token, the value (50) is input into the ‘Input Heads Number’ field (as it should be), but the value is not processed by hitting return or clicking on the ‘Start Tossing’ button (expected behavior).

Please see diagrams on the Evernote link.

Thanks

The problem at this point is you are putting the custom state’s value in the Placeholder field instead of the Initial content field. So, uncheck the box for auto-binding and the Initial content field will appear. Then, remove the value from the Placeholder field and put that value in the Initial content field, and you should be good to go.

2 Likes

Getting closer :thinking:

The Problem:

I have incorrectly set the input field (“Input Heads Number”) for the Initial content to “50 H Group’s Icon value.” But doing it this way, it only works if there is just one icon being clicked, namely the 50 H one. But as there are other icons (51 H, 52 H etc), it will not work for those ones the way I have set it up.

How would I address this issue?

Diagrams here

Thanks

Are we? It doesn’t feel like it. :wink:

Just have one custom state that is a number, and set the Initial content of the input to that custom state. When any of the icons are clicked, use a workflow to set the custom state’s value to the number associated with the icon. It should be that simple.

If you want to give me edit access to your editor (privately), I will set it up for you. It would probably be easier than continuing to go back and forth here.

1 Like

One issue you might have is that “Initial Content” literally means, “initial”. If the user enters a value manually into the input box , the value entered overrides the dynamic custom state expression so it will no longer have a binding to the custom state and won’t reflect any other changes. The way to overcome this is to put the input box in a group, set the Content Type of the group to “number” and the Data Source of the Group to the custom state. On the actual input box set the Initial Content to “Parent Group’s number”. This creates a 2-way binding between the input’s container group and the custom state. Hope this helps.

3 Likes

Thanks for the input.