Modifying Error Message

A

Ashish

Hi,
I am using a form with multiple views , each view containg multiple data
validations. Instead of the default error message shown by Infopath when
validation error occurs, i want to display a more user friendly message. Can
anyone help me with this. I do not have VS.net.
 
A

Andrej

Hi,

you can add datavalidations to your fields in the form.
in the properties dialog of your control "Data" Tab you will find a button
"Datavalidation".
in the datavalidation dialog you can add validations with messages you want.

cu

Andrej
 
A

Ashish

I am sorry i didn't phrase my question properly.
I am just using the validation of "Cannot be blank" and nothing else in all
my fields. So when the user submits the form without completing the mandatory
fields an error message pops up which says " InfoPath cannot submit the form
because it contains validation errors.... If you cannot an error in other
views, there might be a problem with form design"
I just want to change this long error message with a smaller one. The users
are not familiar with InfoPath so they dont know what a view means is etc.
 
A

Andrej

Hi Ashish,

i hope i have a solution for you.
as i wrote before you need to write error messeage for every field which
will be validated as i described before.

to show a better message as infopath do you can use this lines of jscript:

try{
if(XDocument.Errors.length!=0) // analyse are there some errors in the form
{ //show the message of the first error in the form
XDocument.UI.Alert(XDocument.Errors.Item(0).DetailedErrorMessage);
}
else
{ //submit the form to a database
XDocument.Submit();
}
}
catch(ex)
{
XDocument.UI.Alert(ex.message);
}


put this lines of source in OnClick event of a button.
if there is an error user will see your customized message for the field.
if ther is no errors in the form the form will be submitted.

cu

Andrej
 

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