Hello All,
I have a form which has several fields. There is a reset button at the top of the Page -1 of the form which should clear/rest the form. But I have several checkboxes, out of which if some clicked few text fields / drop downs associated with it becomes mandatory. Suppose one clicks Checkbox -1 and the field TextField -1 associated with becomes mandatory.If the user clicks the reset button after clicking the checkbox (which makes the field mandatory) then though the checkbox is unchecked the field remains as mandatory. How to get over it with ? I have placed the script in the change event as well as in the click event of the text box as there are conditions to met (Suppose there are 3 check boxes associated with a text field and the field becomes mandatory if one of them is clicked) Any help would be greatly appreciated.
Thanks.
Bibhu.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Bibhu,
It is difficult to say without seeing the form, but a couple of things:
I would agree with the script being in the exit event.
I have an aversion to naming design pages with a capital 'P', as this is used for Master Pages, so I would generally use page1, ... page5. This isn't the problem here, just a comment.
Good luck,
Niall
Views
Replies
Total Likes
Hi Bibhu,
How about you add a line for each checkbox AFTER the reset command:
// reset the form (including checkboxes)
xfa.host.resetData();
// now that checkboxes are unchecked, fire script again
checkbox1.execEvent("click");
checkbox2.execEvent("click");
checkbox3.execEvent("click");
...
This is on the basis that the script to make the fields mandatory is in the click event of the checkboxes.
Good luck,
Niall
Views
Replies
Total Likes
Hello Niall,
Instead of the click event I have added change event . Now it seems to be working.
Thanks.
Bibhu.
Views
Replies
Total Likes
Hi Bibhu,
Glad its working.
For the checkbox script, I would be inclined to go with the click event.
Niall
Views
Replies
Total Likes
Hello Niall,
I have a textfield(in Page-5) which has an associated readonly checkbox in Page -1 . If someone enters some value in the text field then the checkbox must be checked and vice versa.I have tried the script in exit as well as in the change event of the text field.But the else part does not seem to work.
How to rectify that ?
form1.Page5.SpecialInstructions::exit - (JavaScript, client)
if(SpecialInstructions.rawValue != "")
{
form1.Page1.SpecialInstructions.rawValue = 1;
}
else
{
form1.Page1.SpecialInstructions.rawValue = 0;
}
Thanks.
Bibhu.
Views
Replies
Total Likes
Hi Bibhu,
It is difficult to say without seeing the form, but a couple of things:
I would agree with the script being in the exit event.
I have an aversion to naming design pages with a capital 'P', as this is used for Master Pages, so I would generally use page1, ... page5. This isn't the problem here, just a comment.
Good luck,
Niall
Views
Replies
Total Likes
Hello Niall,
I tried on Null, then it worked. But I am little confused, what's the difference between Null and "" ?
Thanks.
Bibhu.
Views
Replies
Total Likes
Hi Bibhu,
null tests for empty/no value, whereas "" is still a string of zero length. I find testing for null is more robust.
Maybe someone else will have a more technical explanation.
Good luck,
Niall
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies