How to present an error message when checkbox is selected to NO

phr
Tera Contributor

Hi All,

 

I have a requirement that when i select the dropdown option "service required" is only "GitHub Co-Pilot (cost : 19 €/month)" 

phr_0-1717768552742.png

also based on the dropdown i have configured another dropdown "Do you already have a license" 

phr_1-1717768695482.png

When selected "NO" an error message has to be presented saying me to select the option "GitHub Enterprise (cost : 14 €/month)" as shown in the message below.

 

The error message should be presented till i select "GitHub Enterprise (cost : 14 €/month)" along with "GitHub Co-Pilot (cost : 19 €/month)"

How to achieve this?

 

 

 

How do achieve this?

 

2 ACCEPTED SOLUTIONS

Sandeep Rajput
Tera Patron
Tera Patron

@phr Instead of wrapping your function inside an onLoad function. You should put it inside 

function onCondition() {
var sn = g_form.getValue("do_you_already_have_visual_studio_license"); 

if (sn=="No") { 
g_form.addErrorMessage("Please add GitHub Enterprise license to the service required field in this form"); 
}
}

 

Hope this helps.

 

View solution in original post

Zach Koch
Giga Sage
Giga Sage

It looks like you updated the template and it is no longer calling the correct function. You can see in the example below in a fresh UI policy that it is calling onCondition(), yours looks like the template for an onLoad client script. Change your function back to match the screenshot and see if that resolves your issue.

ZachKoch_0-1717767584237.png

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

View solution in original post

4 REPLIES 4

Sandeep Rajput
Tera Patron
Tera Patron

@phr Instead of wrapping your function inside an onLoad function. You should put it inside 

function onCondition() {
var sn = g_form.getValue("do_you_already_have_visual_studio_license"); 

if (sn=="No") { 
g_form.addErrorMessage("Please add GitHub Enterprise license to the service required field in this form"); 
}
}

 

Hope this helps.

 

Hi @Sandeep Rajput ,

 

I put the same code. But still the error message isn't presented.

@phr Just responded to you via a direct message. Please check your inbox.

Zach Koch
Giga Sage
Giga Sage

It looks like you updated the template and it is no longer calling the correct function. You can see in the example below in a fresh UI policy that it is calling onCondition(), yours looks like the template for an onLoad client script. Change your function back to match the screenshot and see if that resolves your issue.

ZachKoch_0-1717767584237.png

 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!