Hello,
I am new to JavaScript, could you pls. consolidate the below 2 IF statements into only 1 summary IF statement (I mean, put the red IF statement into blue IF statement)
my_form:Page1:SunForm1:Middle_Name_text_field ::: Change JavaScript
I wrote the below code in the CHANGE event of a text field of "Middle_Name_text_field"
// Hide associated check box
// As soon as user started entering the data, make associated check box as invisible
// or if erased the data again then make the check box visible
if (xfa.event.newText.length > 0) {
MiddleName_CheckBox.presence = "hidden";
}
else {
// I guess, the below red piece should come here
MiddleName_CheckBox.presence = "visible";
}
var yc //Yellow color
yc = " "
yc = (this.ui.oneOfChild.border.fill.color.value);
// If the Middle Name text field is colored with yellow, then make it again invisible, no matter wht the above IF statement yileds in
if (yc == "255,255,191") {
MiddleName_CheckBox.presence = "hidden";
}
Thank you
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
This should work:
// Hide associated check box
// As soon as user started entering the data, make associated check box as invisible
// or if erased the data again then make the check box visible
var yc = (this.ui.oneOfChild.border.fill.color.value);
if (xfa.event.newText.length > 0 || yc == "255,255,191") {
MiddleName_CheckBox.presence = "hidden";
}
else {
MiddleName_CheckBox.presence = "visible";
}
The || is JavaScript for "or", so that if either condition is met the field is hidden.
Hope that helps,
Niall
Views
Replies
Total Likes
Hi,
This should work:
// Hide associated check box
// As soon as user started entering the data, make associated check box as invisible
// or if erased the data again then make the check box visible
var yc = (this.ui.oneOfChild.border.fill.color.value);
if (xfa.event.newText.length > 0 || yc == "255,255,191") {
MiddleName_CheckBox.presence = "hidden";
}
else {
MiddleName_CheckBox.presence = "visible";
}
The || is JavaScript for "or", so that if either condition is met the field is hidden.
Hope that helps,
Niall
Views
Replies
Total Likes
Thank you once again, being answered on Sunday.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies