Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Setting for as invalid

Avatar

Level 4
hi,



is there a way i can set a form as invalid with script.



when i return false from my initialize event, on submit button, the form seems to gothrough anyway.



is there a build in function i can use?



Thanks!
0 Replies
On the "Click" event, you can have a script like this



if (SomeObject.rawValue != "something you want")

{

app.alert("Can't submit");

exit;

}



let me know if this works

Avatar

Level 4
it still attempts to send the document with the exit;



basically, becuase there is no validation for the checkboxes, i'm doing it manually on the validate event in the submit button via javascript.



my logic is this:



- if the rest of the form is valid aka all required fields are filled in, check for the check boxes (this works)



- if the check boxes are all empty - show a message and don't submit (this is the part where it keeps submitting, no matter if i return true or false)



i'm confused. please help 😞



my submit button (validate event) looks like this:



if (myscripts.validateForm())

{

xfa.host.messageBox("returned true - submit form")

}

else

{

xfa.host.messageBox("returned false - display error and exit")

exit;

}



the value i'm getting from validateForm (true or false) is correct.

Avatar

Level 4
oh, and after putting exit; in, i get a javascript error back saying "exit is not defined"
Have you saved you form as a "Adobe Dynamic XML" ?



Make sure you have chosen the language JavaScript and not FormCalc.