Expand my Community achievements bar.

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

Hidden Email Submit Button & Mandatory Check Boxes

Avatar

Former Community Member

Hi guys

I'm trying to get my form to only allow people to return the form (via email) once they have accepted the terms and conditions AND the privacy policy.

Their acceptance of these is confirmed by 2 check boxes called acceptservicesterms and acceptprivacypolicy respectively. For each of these check boxes I have added this script to 'initialise':

this.mandatory = "error";
this.mandatoryMessage = "You must accept our Services Booking Terms and Conditions to request a booking";

I have then set my email submit button (EmailSubmitButton) to 'hidden (exclude from layout)' and created a 'fake' email submission button in its place. The click event for the FakeEmailSubmitButton is scrpited as:


if (acceptserviceterms.rawValue != "bookingtermsagreed")

xfa.host.messageBox("You must accept our Services Booking Terms and Conditions to request a booking");
}
else if (acceptprivacypolicy.rawValue != "privacypolicyagreed")
{
xfa.host.messageBox("You must accept our Privacy Policy to request a booking");
}
else
{
EmailSubmitButton.execEvent("click");
}

Where the 'on' values are 'bookingtermsagreed' and 'privacypolicyagreed' respectively.

Unfortunately, this hasn't worked for me - I'm not sure if the javascript is completely correct, or if I have gone about this the right way. Can anyone shed any light on what I've done wrong please?

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 6

if (acceptserviceterms.rawValue != "bookingtermsagreed")

in this line the field name is acceptservicesterms but u typed as acceptserviceterms - letter s missing.

after this correction i am able to see the error messages.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

if (acceptserviceterms.rawValue != "bookingtermsagreed")

in this line the field name is acceptservicesterms but u typed as acceptserviceterms - letter s missing.

after this correction i am able to see the error messages.

Avatar

Former Community Member

Thanks Raghu

I guess that I had looked at it for so long that I couldn't see the obvious!

Thanks for spotting this for me...