Hello, first post here. Hope someone can help me as my XML knowledge sucks and I need some coding help.
I am creating a form for "user" creation/change process.
I have a field "DropDownWindowsUser" with values "NEW, CHANGE, and DELETE"
When you select "DropDownWindowsUser" = "NEW" , there is two checkboxes which become visible and ONE of teh two need to be selected". the two checkboxes Is user: left handed or right handed
the two checkboxes are named:
- CheckLeftHanded
- CheckRightHanded
I would like to add an if statement to validate that if "DropDownWindowsUser" field = "NEW" then the person need to have selected one of the two checkboxes "CheckLeftHanded" or "CheckRightHanded" need to have a value of 1 (selected)
Anyone willing to show how such a statement should be written to check that such a selection has been made when creating NEW user and it should give error. "Please select left or right handed"
Thank you in advance.
Johan
Solved! Go to Solution.
Views
Replies
Total Likes
I found another piece of code on the site here related to something else and from that I tried somthing simmilar and now it work.
if (form1.DropDownWindowsUser.rawValue == "New"){
if (form1.CheckLeftHanded.rawValue == 0 && form1.CheckRightHanded.rawValue == 0 ){
error = true;
error_string = error_string + ": Under section NEW USER DETAILS, please select Desktop or Notebook user checkbox. ";
}
}
basically I check if both check box values are zero, then issue a warning.
So it is working this way.
Views
Replies
Total Likes
I found another piece of code on the site here related to something else and from that I tried somthing simmilar and now it work.
if (form1.DropDownWindowsUser.rawValue == "New"){
if (form1.CheckLeftHanded.rawValue == 0 && form1.CheckRightHanded.rawValue == 0 ){
error = true;
error_string = error_string + ": Under section NEW USER DETAILS, please select Desktop or Notebook user checkbox. ";
}
}
basically I check if both check box values are zero, then issue a warning.
So it is working this way.
Views
Replies
Total Likes
Hi,
The easiest way would be to check the value of the dropdown and the addition of the two checkboxes. By default a checkbox has the following binding: On = 1 and Off = 0. Therefore if you add the two checkboxes together and get 0, you know that the user has not selected either.
There is an example here for tracking if checkboxes are ticked: http://assure.ly/xDbtbx and http://assure.ly/omsURE.
Something along the lines of the following JavaScript
// Declare a variable
var vCheck = CheckLeftHand.rawValue + CheckRightHand.rawValue
if (DropDownWindowsUser.rawValue == "NEW" && vCheck == 0) {
app.alert("You have not selected a checkbox.");
}
Hope that helps,
Niall
Views
Likes
Replies