Highlighted

Drop Down Box scripting (JS)

Avatar

Guest

28-07-2008

Hi



Reviewing some of the other postings, I've been able to set up a Drop Down Box, script getting the selection and using it to populate a Text Field Box with a variable's value (depending on which Drop Down Box item is selected by the user, this will set the text field's value):



//placed in the change event

var sNewValue = this.boundItem(xfa.event.newText)

TextField1.rawValue = sNewValue



This works OK. However, I am unable to successfully script a conditional action if sNewValue = a specific value (for example "value1"), to have it execute another action making a check box visible (this check box, on initialize, has the script: this.presence = "invisible")I've tried adding an "if" for example:



if (sNewValue = "value1")

{

CheckBox7.presence = "visible"

}



This doesn't work.



I'm relatively new to LiveCycle and using JS to script in it and can't figure out how to script this additional conditional action triggered by the user choosing one specific item in the drop down list.



Any help would be appreciated.



Kind Regards,



Stephen

Replies

Highlighted

pguerett

28-07-2008

In javascript to do a comparison between values you need a double = so your code would be:



if (sNewValue == "value1")

{

CheckBox7.presence = "visible"

}



Also make sure that your form is being rendered as dynamic.
Highlighted

Avatar

Guest

28-07-2008

Hi Paul,



Thank you for your reply. I still can't get this to work. The form is saved as XML (.xdp), so I think this is dynamic (form has several other dynamic interactive features).



The JS I am using in the DropDown List Box's change event is:



var sNewValue = this.boundItem(xfa.event.newText)

TextField1.rawValue = sNewValue

if (sNewValue == "coronary artery disease, early onset: (male) <55, (female) <65")//value given to the corresponding drop down text item

{

TextField2.rawValue = CAD.value

CheckBox7.presence = "visible"

}



(It's a health form: when the user chooses a disease from the drop down box, it displays info like the sNewValue in quotes above for each disease.)



As you can see from the above, this particular disease choice needs to display another TextField box (TextField2) and needs to make visible a CheckBox (CheckBox7) that is made "invisible" when that CheckBox initializes (this.presence = "invisible").



Oddly, while the script: TextField2.rawValue = CAD.value

works OK (the TextField2 displays the CAD.value correctly), the second script action: CheckBox7.presence = "visible" does not work (the Check Box stays "invisible").



New to LiveCycle, I suspect this is due to some script mistake I am making or using the wrong events, but after much trying, I can't seem to find and correct it.



Any suggestions would be appreciated.



Kind Regards,



Stephen
Highlighted

Avatar

Guest

28-07-2008

Hi Paul,



Thanks for your kind offer to take a look. Having just upgraded from Acrobat 8 Pro to 9 Pro (form started in Acrobat8), I checked how the latest LiveCycle (now ES) was saving the form. I had it wrong: it was saved as XML (.xdp), so I changed it to XML (.pdf). Now it works fine.



I had written a separate posting about Rights Management servers that has yet to get a response:




Stephen Wartel, "LiveCycle Designer ES Rights Management" #, 27 Jul 2008 12:12 pm



If you have any leads, I would be grateful. I don't understand this new ES feature that I apparently now have access to, and it may be helpful for health projects with sensitive data, if I can figure out if and how to use it.



Thanks again,



Stephen
Highlighted

Avatar

Guest

14-08-2008

Hi everyone!

I have the table with 3 columns - name&surname,birthday and the place of birthday.

Also I have drop-down list which is filled with items from name&surname column and 3 text fields which according as birthday and place of birthday columns.

So, when I will choose one item from drop-down list, I want that 3 text fields automatic will fill up with data from table.

I hope you understood me.

Thanks anyway!