Highlighted

Conditional Mandatory Fields

Avatar

Guest

15-10-2008

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?

Replies

Highlighted

Avatar

Guest

15-10-2008

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
Highlighted

Avatar

Guest

15-10-2008

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
Highlighted
Highlighted

Avatar

Guest

15-10-2008

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
Highlighted

Avatar

Guest

16-10-2008

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
Highlighted

Avatar

Guest

19-10-2008

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
Highlighted

_Jenn_Dickens_

24-10-2008

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.