Good afternoon,
I'm trying to implement a requirement such that if data is entered in text field A then text field B is required. From the research I've done on the forum, I believe I need to use the change event. But the only related entries I've seen involve drop downs or radio buttons and I'm not sure how to translate that into whether or not data is entered into a text field. Thanks in advance!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Pobably a samll mistake you have made. It should be xfa.event.newText. Not xfa.eventnewText . If you see carefull you have missed the "dot/." between event and newText. Try it and see what happens next.
Thanks,
Bibhu.
Views
Replies
Total Likes
You can also put it in the exit event of your field A:
if (!this.isNull)
TextFieldB.mandatory="error";
else
TextFieldB.mandatory="disabled";
Kyle
Views
Replies
Total Likes
Thanks, Kyle! Your way makes much more sense. I implemented it and now there is a red border around field B when field B is left blank but data is entered into field A. Can you please tell me how to implement a pop up so it's clear to the user that if there is data in field A that field B is required?
Views
Replies
Total Likes
if (!this.isNull){
xfa.host.messageBox("You must fill out field B!");
TextField3.mandatory="error";
}
else
TextField3.mandatory="disabled";
Kyle
Views
Replies
Total Likes
Thanks a lot! If instead of field A being a text box, I change it to a drop down and it is the option "Other" that requires a entry in Field B, would the code be as follows:
if (this.rawValue == "Other") {
xfa.host.messageBox("You must fill out field B!");
TextField3.mandatory="error";
}
else
TextField3.mandatory="disabled";
Views
Replies
Total Likes
The right version have to be:
if (xfa.eventnewText == "Other")
{
//OR app.alert("You must fill out field B!");
//OR xfa.host.messageBox("You must fill out field B!", PLEASE READ", 1,0);
xfa.host.messageBox("You must fill out field B!");
TextField3.mandatory="error";
}else
{
TextField3.mandatory="disabled";
}
Hope it's helpful,
Mandy
Views
Replies
Total Likes
Thanks, Mandy. Should this be on the change event? I'm having trouble getting it to work for some reason. I'm pretty inexperienced so I'm sure I'm overlooking something trivial. This is what I put on the change event:
if (xfa.eventnewText == "Other")
{
//OR app.alert("You must fill out field B!");
//OR xfa.host.messageBox("You must fill out field B!", PLEASE READ", 1,0);
xfa.host.messageBox("You must fill out field B!");
other.mandatory =
"error";}
else
{
other.mandatory =
"disabled";}
Views
Replies
Total Likes
Hi,
the LCD is case sensitiv.
Other is not the sam as other.
You have to write
Other.mandatory = "error";
Other.mandatory = "disabled";
NOT
other.mandatory = "error";
The change-event is right.
Helpful?
Mandy
Thank again, Mandy. I changed all instances of "Other" to all start with an uppercase "O" but I still can't get it to work! I'm not getting an error, but nothing happens. Thanks in advance!
if (xfa.eventnewText == "Other")
{
//OR app.alert("You must fill out field B!");
//OR xfa.host.messageBox("You must fill out field B!", PLEASE READ", 1,0);
xfa.host.messageBox("You must fill out field B!");
Other.mandatory =
"error";}
else
{
}
Other.mandatory = "disabled";
Views
Replies
Total Likes
Hi,
Pobably a samll mistake you have made. It should be xfa.event.newText. Not xfa.eventnewText . If you see carefull you have missed the "dot/." between event and newText. Try it and see what happens next.
Thanks,
Bibhu.
Views
Replies
Total Likes
Thank you very much!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies