Expand my Community achievements bar.

Radio button instead of Check Box in Textfield.

Avatar

Former Community Member
I am trying to use the Radio Button instead of Check box in JavaScript, posted by Steve Woodruff (Jul 3, 06) in replay of "Unenable TextField" from Brad McIntyre (Jun 30, 06), but this script doesn't work.

What should i change in this script to make it work?

I am new in Designer, so any help will be really appreciated.



Thanks,

Sergei.
4 Replies

Avatar

Former Community Member
What exactly are you trying to do? Disable a text field using a radio button?



Unfortunately, I don't know these scripts you're referring to so here's another one which will enable or disable a text field depending on which radio button is picked within a radio button list. The text field's caption and value font color will also change between black (enabled) and gray (disabled).



See the script on the RadioButtonList1 field's Click event.



Stefan

Adobe Systems

Avatar

Former Community Member
Stefan,

I am trying to make a script for group of 5 radio buttons with text fields for each of the button to enter the users data (such as multiline text). Checked radio button (with filled text) must be printed on a final document when user submits the form, others should disappear.



Below the message and script I mentioned before, but that one doesnt work with my form. Your script works.



Thank you very much for your help,

Sergei.



Original message "Unenable TextField" and script:

Brad McIntyre - 09:16am Jun 30, 2006 Pacific

Hi,

I have a check box and a Text Field. I want the text field to be inactive until the user checks the check box. So when the user checks the check box, the text box becomes active and the user can then enter info into it.



A. How do I make the text box inactive?

B. How do I make the text box active when the check box is checked? (I know I'll have to do script, and I think I can do that part, but I don't know the command)



Thanks



Brad

Messages

3 messages. Displaying 1 through 3.

First Previous Next Last

Show All Messages

Steve Woodruff - 1:10am Jul 3, 06 PST (#1 of 3)

Edited: 03-Jul-2006 at 01:10am

In the textfield's object palette in the value tab, select "calculated - read only". Then, edit the "click" event of the checkbox in question and enter the following JavaScript:



if(this.rawValue == 1)

xfa.resolveNode("form1.#subform[0].textfield1").access = "open";

else

xfa.resolveNode("form1.#subform[0].textfield1").access = "readOnly";



You may want to adjust "form1.#subform[0]" to meet your form structure.

To do this, while in the editing modus of the textfield, hold CTRL while leftclicking the textfield.

Steve

Avatar

Former Community Member
You're welcome.



So it sounds like you want a form on which there are 5 radio buttons and each one has a pertaining multi-lined text field. When a radio button is selected, only its pertaining text field should be visible and any value entered into a text field previously visible should be erased. Is that right?



I put this together into a little sample. The idea is that only the text field pertaining to the selected radio button is visible. If another radio button is selected, any data entered into the text field pertaining to the radio button that was previously selected is discarded. When the for is submitted, you only get the data for the visible text field pertaining to the selected radio button.



Does this get you closed to what you're trying do accomplish?



Stefan

Adobe Systems

Avatar

Former Community Member
Stefan,

This is exactly what i am trying to do for the last week.

Thank you very much for your tremendous help.

Sergei.