Hi,
I am working on a form with a set of radio buttons: individual or joint.
A dropdown list will become visible if user clicks joint. How can I set this dropdown list to be mandatory only when "joint" is clicked?
And also - what would be the scripting like if I want to set a text field to become mandatory depending on radio button clicked?
Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
Hello,
You can write the following script in the click event of the radio button
to make the TextField or the DropDownList mandatory and visible when the radio button is clicked and
text field / dropdown not to be mandatory when it is hidden.
if (this.rawValue == 1)
{
TextField1.presence = "visible";
DropDownList1.presence = "visible";
TextField1.mandatory = "error";
DropDownList1.mandatory = "error";
}
else
{
TextField1.rawValue = null;
DropDownList1.rawValue = null;
TextField1.presence = "invisible";
DropDownList1.presence = "invisible";
TextField1.mandatory = "disabled";
DropDownList1.mandatory = "disabled";
}
Thanks,
Debadas.
Views
Replies
Total Likes
Hi,
The answer is:
DropDownList1.validate.nullTest = "error";
Works for any field, dropdown or radio button group.
Good luck,
Stephen
Views
Replies
Total Likes
Thanks Stephen.
Perhaps I didn't stay it clear enough on my initial message - I don't want the text field / dropdown to be mandatory when it is hidden.
Is there way to set it to become mandatory only when it is visible upon the right click (in this case - "joint' is clicked)?
Cheers.
Views
Replies
Total Likes
Hello,
You can write the following script in the click event of the radio button
to make the TextField or the DropDownList mandatory and visible when the radio button is clicked and
text field / dropdown not to be mandatory when it is hidden.
if (this.rawValue == 1)
{
TextField1.presence = "visible";
DropDownList1.presence = "visible";
TextField1.mandatory = "error";
DropDownList1.mandatory = "error";
}
else
{
TextField1.rawValue = null;
DropDownList1.rawValue = null;
TextField1.presence = "invisible";
DropDownList1.presence = "invisible";
TextField1.mandatory = "disabled";
DropDownList1.mandatory = "disabled";
}
Thanks,
Debadas.
Views
Replies
Total Likes
Hi,
Sorry, I didn't consider that you needed the rest of the details for a complete script. I thought you were just looking for the method.
Good luck!
Stephen
Views
Replies
Total Likes
Views
Likes
Replies