Expand my Community achievements bar.

radio button to text field

Avatar

Level 3

Hi there,

I have a (probably) easy question to answer for a programming newbie.

I have a radio button - it says are you left or right handed - so two options: left and right - I have also changed their values from 0 and 1 to left and right. I've called the object name: 'handed' and set it to global data

On another part of the form I would like an uneditable text field that says: this person is ... handed

...so in other words there's a gap where I want the text to say 'left' or 'right' - I've also given this field the name 'handed'.

It almost works, but instead of showing the name I get the value (ie. 0 or 1) - can anyone help me to change the value into the text?

Many thanks,

Sunil

I'm using ES4 by the way.

4 Replies

Avatar

Level 2

in your code, it should read something like this...in Javascript on calculate event of text field.

var oHand = radiobutton.rawValue

if oHand = "0";

then this.rawValue = "this person is left handed";

else this.rawvalue = "this person is right handed";

Avatar

Level 3

Hi again,

well, I don't know what I did wrong before, but this time round I changed the values from 0 and 1 to right and left and lo and behold it worked - so didn't need to resort to coding for this one.

However, before doing that I tried what you said above but couldn't get it to work - am I missing syntax here - not sure. Also, wasn't sure when the calculate event would happen. Ie. is it instantaneous with when the user clicks on the radio button to make the selection, or does the event need to be triggered somehow - eg. using a button on click etc.?

Thanks for your help though - much appreciated.

Sunil

Avatar

Level 2

would you mind posting the correct coding that worked for you?

Avatar

Level 3

Hi there - didn't have to use any coding at all - just gave the text field the exact same name as the radio button set.

As soon as the user clicks on one of the radio buttons the text field changes to 0 or 1. However, the next step is to go back to the radio buttons and in the object palette - binding tab change the values (double click on each one) from 0 to left and 1 to right.

I get the feeling this is a bit of an ugly way to do it, and I do really need to learn how to do it with scripting.