save when form doesn't contain error

M

MAxJ

Hi all!

I would like to save my form only if there are no error on the form
(required flied are entered and all type and format are respected).

Actually, it's possible to save the form even if required fields are not
entered or fi the formats are not respected. I only receive a box that tell
me that form contains error, but clicking on yes, it's possible to save. My
goal is exactly to enforce user to correct form before saving (allow save
only when form doesn't contain any error).

Thanks for your help!

Regards,
 
K

Kalyan G Reddy MVP (GGK Tech)

Hello

You have to add code to do so
Open the Tools->form options and select Open and Save Tab
then under save behaviour select the check box Save using Custom code
Click Edit button to open the script editor and add this code

function XDocument::OnSaveRequest(eventObj)
{
if(XDocument.Errors.Count > 0)
{
return;
}

eventObj.IsCancelled = eventObj.PerformSaveOperation();

// Write the code to be run after saving here.

eventObj.ReturnStatus = true;

}


Hope this helps you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top