Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Check fields when approve or deny

Avatar

Former Community Member

Hello,

Can any one please check for me if there is something wrong or if I miss any thing in the statement below which causes it to not working right. User fills the form and submit it to the manager, when the manager approve/deny then he/she should fills the other fields. If they miss one then a pop up message will tell them that they need to fill that field which is highlighed.

if

(AWS_ACTION.rawValue == "Deny" && (form1.Wellness_Page1.denied_reason.rawValue == null || form1.Wellness_Page1.denied_reason.rawValue == "" ) )

{

app.alert("Please select deny, enter your name and today's date for denial. ");

form1.Wellness_Page1.denied_reason.mandatory

= "error"; // make the comments field mandatory

form1.Wellness_Page1.SupDeny.mandatory

= "error"; // make the fields mandatory

form1.Wellness_Page1.sup_signature.mandatory

= "error";

form1.Wellness_Page1.SupDate.mandatory

= "error";

xfa.event.cancelAction

= true; // This line will prevent submitting the form

}

else {

(AWS_ACTION.rawValue == "Approve" )

{

app.alert("Please select approve, enter your name and today's date for approval. ");

form1.Wellness_Page1.SupApprove.mandatory

= "error"; // make the fields mandatory

form1.Wellness_Page1.sup_signature.mandatory

= "error";

form1.Wellness_Page1.SupDate.mandatory

= "error";

xfa.event.cancelAction

= true; // This line will prevent submitting the form

}

}

Please advise.

Thanks, Han

2 Replies

Avatar

Level 10

This might be just the formatting of the post but the line;

else {

(AWS_ACTION.rawValue == "Approve" )

should be

else {

if (AWS_ACTION.rawValue == "Approve" )

That is you'll need the "if" keyword.

Hope that helps

Bruce

Avatar

Former Community Member

Ah, I can't believe I missed that magic "word'. It works!

Thanks Bruce,

Han