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
BedrockMission!

Learn More

View all

Sign in to view all badges

Conditional Mandatory Fields

Avatar

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

Avatar

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

Avatar

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

Avatar

15-10-2008

In LC Designer there is script view with differnt sort of events. Yiu can put those scripts to change or click event.

Avatar

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

Avatar

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

Avatar

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

Avatar

20-10-2008

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

2) script written in formcalc

Avatar

Avatar
Level 2
_Jenn_Dickens_
Level 2

Likes

0 likes

Total Posts

18 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
_Jenn_Dickens_
Level 2

Likes

0 likes

Total Posts

18 posts

Correct Reply

0 solutions
View profile
_Jenn_Dickens_
Level 2

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.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

24-10-2008

Just change it from nulltest="error" to nulltest=""