cancel
Showing results for 
Search instead for 
Did you mean: 

how to create an error message which doesn't allow submitting form ?

Former Member
0 Kudos

Hi,

is there a way to create an error message so that the user can't submit the form until the error is solved?

On my form I am doing some validation checks when the user hits the button to submit the form via e-mail.

So if something on the form isn't filleld out correctly the user gets an error message. But after the user has clicked ok on the error message he can still send the form.

So I am searching for a way that he can only submit the form if he has resolved the problems.

I tried with

xfa.host.messageBox("material is not valid!" , "error", 0);

but this only shows the error messagen and doesn't prevent the next step.

Can I solve this with using a different type of error message, or user different parameters at the messageBox?

Thanks for your help.

Martin

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Well you can have two buttons, Validate Form and SubmitByEmail on your form.

Now only if Validate Form button returns you no error, make the Submit Email button visible else keep it hidden.

Also put all validations in the exit event of fields as well so that if user tries to change after Submit Email button has become visible it will take care of that as well.

Former Member
0 Kudos

Thanks.

I implemented it like described and it is working fine.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi Martin Beyer

try like this.

in submit button CLICK event u have to right validation for fields which u want to check.

example : here iam validating two varibles.

var sub=0;

if(sub==0)

{

if(fields2.item(i).rawValue == null && fields.item(i).rawValue != null)

{

sub++;

xfa.host.messageBox("Status of Achievement is Mandatory");

xfa.host.setFocus(fields2.item(i));

break;

}

}

if(sub==0)

{

var Repe = xfa.host.messageBox("Do you want to Submit now???", "Warning", 2, 2);

if (Repe == 4)

{

sub=0;

}

else

{

sub++;

}

}

hope it will help you.

Former Member
0 Kudos

hi,

thanks for your reply.

I will try to build that in my form.

Regards,

Martin