Hi,
If I have 3 fields and the status mandatory of the field is defined by certain user input.
What I mean is something like this:
I have Field1, Field2, Field3. The status of Field1 is mandatory and the status mandatory of the Field2 and Field3 are defined by what the user entered in Field1.
For e.g. if the user enter N/A in the Field1 then Field2 and Field3 become not mandatory but other than that Field2 and Field3 are mandatory.
Is that possible to do that? If so any example that I can see?
Could the Mandatory status created when the user do somethi
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 305
- Joined: Thu Jul 02, 2015 8:32 am
- Location: Indonesia
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
You can dynamically set a field mandatory. To make this work in your example you need to click the Immediate Validation option for the Field1 Field Control. Then when a value is entered for this field the On Change event will run on the server.
Your On Change event will look something like this:
This works by running a server-side event so can cause a slight delay for the user - you should test to see if this is acceptable.
Another approach is to check all the input on the server after it's been entered and issue any messages you need to. But then of course the user can't immediately see which fields are mandatory.
Your On Change event will look something like this:
Code: Select all
if (fields.Field1.value == "xxxx")
{
fields.Field2.fieldControl.mandatory = true;
fields.Field3.fieldControl.mandatory = true;
}
else
{
fields.Field2.fieldControl.mandatory = false;
fields.Field3.fieldControl.mandatory = false;
}
Another approach is to check all the input on the server after it's been entered and issue any messages you need to. But then of course the user can't immediately see which fields are mandatory.
0 x
-
- Ebase User
- Posts: 305
- Joined: Thu Jul 02, 2015 8:32 am
- Location: Indonesia
Thank you very much. I will try it.
Hope it is run as I expected.
Hope it is run as I expected.
Jon wrote:You can dynamically set a field mandatory. To make this work in your example you need to click the Immediate Validation option for the Field1 Field Control. Then when a value is entered for this field the On Change event will run on the server.
Your On Change event will look something like this:
This works by running a server-side event so can cause a slight delay for the user - you should test to see if this is acceptable.Code: Select all
if (fields.Field1.value == "xxxx") { fields.Field2.fieldControl.mandatory = true; fields.Field3.fieldControl.mandatory = true; } else { fields.Field2.fieldControl.mandatory = false; fields.Field3.fieldControl.mandatory = false; }
Another approach is to check all the input on the server after it's been entered and issue any messages you need to. But then of course the user can't immediately see which fields are mandatory.
0 x
Who is online
Users browsing this forum: No registered users and 16 guests