Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Conditional Mandatory Fields

Not applicable
Hi,



Im looking for help on this one... How can I make a text field mandatory if someone ticks a check box or completes another field?
10 Replies
Not applicable
if ("checked") then

form.textField.validate.nullTest="error"

endif



Or onchange event of the second TextField put this:

form.textField.validate.nullTest="error"



Best regards
Not applicable
Hi Paul,



Thanks for that, I was wondering if this is the sort of thing I need to use but Im new to LiveCycle and I dont know where to actually put this code. Do I put it in the xml view or what? Im not sure?



Thanks again for your help..



Ross
Not applicable
In LC Designer there is script view with differnt sort of events. Yiu can put those scripts to change or click event.
Not applicable
Hi Paul., sorry, I remember seeing this field now. This is what Ive got in the field now:

form1.#subform[0].Taxi::preSubmit:form - (FormCalc, client)



if ("checked") then

form.Mobile.validate.nullTest="error"

form.Pickup-1.validate.nullTest="error"

form.Dropoff-1.validate.nullTest="error"

form.Collect-Date-1.validate.nullTest="error"

form.Collect-Time-1.validate.nullTest="error"

endif



Ive tried this but the form doesnt do what I want. I need the above fields to be mandatory if the 'taxi' box is ticked.



Any ideas?



Thanks



Ross
Not applicable
if ("checked") then - it was logical expression.

Code expression is:



if (taxi.rawValue==1) then

form.Mobile.validate.nullTest="error"

form.Pickup-1.validate.nullTest="error"

form.Dropoff-1.validate.nullTest="error"

form.Collect-Date-1.validate.nullTest="error"

form.Collect-Time-1.validate.nullTest="error"

endif
Not applicable
Hi Paul,



Thanks again for your help, it mates sense now but I think Im sticking on a couple of things, this is whats in the script box now when you highlight the checkbox:



form1.#subform[0].Taxi::preSubmit:form - (JavaScript, client)

if (taxi.rawValue==1) then

form.Mobile.validate.nullTest="error"

form.Pickup-1.validate.nullTest="error"

form.Dropoff-1.validate.nullTest="error"

form.Collect-Date-1.validate.nullTest="error"

form.Collect-Time-1.validate.nullTest="error"

endif



What im stuck on is:

1) which point do i want this script? ie: in the 'show' box, I currently have selected 'presumbit*' which is the section where the code is now.

2) What langauage do I use? when I tried formcalc i got an error, it seems to be happier with javascript



Sorry to be a pain.



Ross
Not applicable
1) You wanted to have validation script when checkbox is checked.

2) script written in formcalc
_Jenn_Dickens_
Level 2
Level 2
Hello,



I have a similar situation. I have been able to make a certain field mandatory when a particular box is checked. My problem is that I do not know how to make it optional if the user changes their mind and unchecks the box. Is there a way to make this happen? Thank you in advance for any help.



Jenn D.
pguerett
Level 10
Level 10
Just change it from nulltest="error" to nulltest=""
_Jenn_Dickens_
Level 2
Level 2
Paul,



Thank you!!! It works just like I want it to now!



Jenn D.