Expand my Community achievements bar.

Required Radio Buttons & Check Boxes

Avatar

Level 4

Hi,  I'm using LC Designer ES 8.2 and Acrobat 7.0.  I searched the forum and found scripts for mandatory options, but I'm having no luck.  I have two issues, one with radio buttons and another with check boxes/required section.

Problem #1:

I have a radio button that is required and it is called submitBy. The two options of the radio button are Field and Home Office.  Field has the value of 1 and Home Office has the value of 2.  If the user selects Field, I want to have another set of radio buttons required, but if the user selects Home Office, the set of radio buttons are not required.  This should be validated when the user clicks on a Submit button to send the form by email.

The submitBy radio button field is set to User Entered - Required and have the following script in the change event (I tried the click event as well)

form1.Page1.submitBy::change - (JavaScript, client)

 

if (this.rawValue == "1") {

fieldOption.mandatory = "error";

}

else

{

fieldOption.mandatory = "disabled";

}

The fieldOption radio button is set to User Entered - Optional

The Submit Button has the following script:

form1.Page1.Button1::click - (JavaScript, client)

if (form1.execValidate() == true){

    event.target.submitForm({cURL:"mailto:example@example.com?subject=Example Form&body=",cSubmitAs:"PDF",cCharset:"utf-8"});

} else {

    app.runtimeHighlight = true

    app.alert("You have not entered all required fields.....required fields are highlighted for your convenience.")

}

If I don't select a submitBy option, the form does what it is suppose to do, however, if I select the Field option of the submitBy radio button and do not select an option from the fieldOption radio button, the form does not error and can be sent by email and should not.

Problem #2:

I have a section of the form that is required and has several check boxes. The user must check at least one option and can check as many as apply.  Is there a way to make a section required so I don't have to put a script in each check box.  This should be validated once the user clicks on the Submit button.

Thanks

0 Replies