Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

How Do I Supress Validation Message Box?

Avatar

Level 3

This is how my form is set up

1) I have a checkbox "A" in the main subform1

2) I have 15 checkboxes in another subform2 (hidden initially)

3) when checkbox "A" in subform1 is selected/checked, subform2 unhhides itself and allows users to select one or more checkboxes in subform2

4) in the validate event of subform2, I have a script that checks to see if there are at least one checked checkbox selected, if so it returns true (valid) or else it returns false (invalid)\

My question is, if I don't check any of the 15 checkboxes in subform2 (obviously fails the validation script), and I execute xfa.form.execValidate(), it would pop up a message box saying "The value you entered for  is invalid".

If I click OK, then it would then pop up rest of the error messages from other fields.   I do not wish to see 2 pop ups when doing validation.

How do I supress the validation error popup for the subform2?


Thanks in advance.

22 Replies

Avatar

Level 10

Instead of placing the script in the Validate event of the Subform, if you can place it in the Submit button click event or any other event may stop this multiple popups.

Thanks

Srini

Avatar

Level 3

Which event might that be?  I tried the "exit" event of subform2, this gets rid of the annoying validation message, but it won't validate and would allow user to submit without selecting any of the 15 checkboxes in subform2.

I don't know any other event that does "validate" silently...

Help appreciated, thanks.

Avatar

Level 10

Use preSubmit event to check the Mandatory/ Required Fields before Submit..

Check this forum for settings..

http://forums.adobe.com/thread/606762?tstart=0

//Check if all the mandatory fields are filled in or not
if(isMandatoryFieldMissed.value == "0"){
this.resolveNode("#event").submit.target = "Place your Submit URL in double quotes";

}
else{
xfa.host.messageBox("One or more of the required fields were missing data before submitting.");       
}

Thanks

Srini

Avatar

Level 3

Ok, so if I move the validation script I have for subform2 from "validate" event to the "presubmit" event of subform2.   How then do I modify for it to cancel submit when it detects that none of the 15 checkboxes are checked in subform2?

Here is my validation code in the validate event.

--

var oNodes = this.nodes;

var sum = 0;

for (var i=0; i<oNodes.length; i++) {

     if ((oNodes.item(i).className == "field") && (oNodes.item(i).ui.oneOfChild.className == "checkButton"))

          sum = oNodes.item(i).rawValue + sum;

}

if (sum <1)

     false;

else

     true;

--

How do I put in the preSubmit event to stop the submission if fails?

Thanks in advance.

Avatar

Level 3

Btw, we are using the form on workspace only, so the submitToURL is blank.


Avatar

Level 3

Can I use xfa.event.cancelAction = true?   It cancels the submission, but instead of popping up an annoying validation message that I didn't have control over, now it pops up the "Submission was cancelled" message that I still don't have control over.

Can I supress "Submission was cancelled" msgbox?   Um...

Avatar

Level 10

May be this could help..

If you are doing the PDF submission via workspace, then you can place the Process Fields on the PDF. (Insert -> Custom fields -> Process Fields).

This will place a normal button and a hidden Submit button (FSSUBMIT)..

If you check the click event of the normal button, you can see the below code in the else part to execute the click event of Hidden Submit button.

Hidden Submit button is the actual Submit button for this form.

else {
     FSSUBMIT_.execEvent("click");
}

You can try replacing the code in the click event of the normal Submit button and put the above else part only after all the validations are satisfied.

My workspace is not configured so I am not able to provide you the test file but the above approach can help you..

Hope this helps..

Thanks

Srini

Avatar

Former Community Member

I am facing the same problem as described below ...

did u get a solution for supressing the Cancel Submit message box ??

if yes please share .. (rmchalukya@gmail.com)

     Can I use xfa.event.cancelAction = true?   It cancels the submission, but instead of popping up an annoying validation message that I didn't have control over, now it pops up the "Submission was cancelled" message that I still don't have control over.

     Can I supress "Submission was cancelled" msgbox?   Um...

Avatar

Level 3

Hi,

Basically, what I ended up doing was this.

1) create a fake submit button, that runs validation on click

2) create a counter, this tracks the number of invalidate fields

3) before the real submission happens, check the counter, if it is greater than 0, obviously there are invalidate fields on the form

4) color those fields or popup error messages and point focus to the first invalidate field

5) after everything is validated, the counter should be 0

6) now do the real submit

Hope this helps.

This helped me:  http://forms.stefcameron.com/2006/08/24/complex-validations/

Nelson

Avatar

Former Community Member

Thank u Nelson,

I have done my form validation accordingly.

But my requirement was when a user submits a completed form, I need to show a message box saying -

"Would you like to submit the Form"

If user clicks YES, I have to submit the form.

If user clicks NO, I have to cancel the submit action and to do this I am using xfa.event.cancelAction = true ;

How can I avoid this "Submit Cancel" message :-(

or is there any other way to my requirement.....

Thanks and Regards,

Chalukya (rmchalukya@gmail.com)

Avatar

Former Community Member

If you cancel an action programmatically then that message cannot be bypassed. If you want to avoid that then hide your submit button and have a regular button that looks like your submit button. Then you can write code on the click event of the fake button like this:

var answer = app.alert("Would you like to Submit the form?", 2,2,"Title of Msg Box")
if (answer == 4){
//User said yes
Button2.execEvent("click");
} else {
//User said no
}

The 2nd parameter (2) indicates that the icon shoudl be a Question and the 3rd parameter (2) indicates you want Yes, No.as the options. If you want to include a Cancel button you can change that to 3

The value returned will be based on the button clicked. Yes will be 4, No will be 3 and cancel will be 2

Hope that helps

Paul

Avatar

Former Community Member

Hi Paul,

Thanks for ur reply.

I can have a fake submit button ( asRegular ), but I am showing my Form in worksapce.

So this fake button will not show up as complete button in workspace.

How do I do this ?

Thanks again.

Chalukya

Avatar

Former Community Member

The button in workspace actually clicks a button that is added to the form. If you add the Process Fields object from the custom library you will see the actual button. You can add your code to the AWS_Submit button. Do not change the code that is already there. You can execute that code that is there instead of clicking the fake button.

Paul

Avatar

Former Community Member

Hi Paul,


I added the process fields on to my form and also the code to AWS_SUBMIT button - "click" event.
Now AWS_SUBMIT button is Regular Button.
And Button2 is my actual Submit Button (hidden).

But when I complete the form from workspace the click event code in AWS_SUBMIT button is not getting
executed and hence the form is getting submited without any pop-up.
I tried adding the same code to AWS_SUBMIT button - "pre-submit" event, the pop-up showed up but

the submit action was not controled.


Code added in AWS_SUBMIT button events -

var answer = app.alert("Would you like to Submit the form?", 2,2,"Confirmation Message")
if (answer == 4)

{

     Button2.execEvent("click");
}

else

{
}

Thanks and Regards,

Chalukya.

Avatar

Former Community Member

AWS_Submit will call a button called FSSUBMIT_  ...you do not need your own submit button. You can access the FS_Submit button form the hierachy view.

Paul

Avatar

Former Community Member

Hi Paul,

Now I have am using the FSSUBMIT_ instead of my own submit button.

But still facing the same problem as in my previous post .

Thank you

Chalukya.

Avatar

Former Community Member

Sorry I have lost track of the original problem ,,,can you restate it please?

Paul

Avatar

Former Community Member

Sure Paul ...

My requirement was when a user submits a completed form, I need to show a message box saying -

"Would you like to submit the Form"

If user clicks YES, I have to submit the form.

If user clicks NO, I have to cancel the submit action and to do this I am using xfa.event.cancelAction = true ;

But how can I avoid "Submit Cancel" message box ?

-----------

For this you have provided a solution to use a fake submit button and call actual submit button on click of fake button as below ..

var answer = app.alert("Would you like to Submit the form?", 2,2,"Title of Msg Box")
if (answer == 4){
//User said yes
Button2.execEvent("click");
} else {
//User said no
}

----------

And now I am stuck with ...

The process fields on my form and the code on AWS_SUBMIT button - "click" event.
Now AWS_SUBMIT button is Regular Button.
And FSSUBMIT_ is my actual Submit Button.

I have added above code on AWS_SUBMIT button - "click" event,without changing any code that was already present in the "click" event of AWS_SUBMIT button. But it is not work. I am not geting any popup message as "Would you like to Submit the form?" and the form is getting submited.

Please suggest.

Thanks

Chalukya.

Avatar

Former Community Member

By clicking on the fake submit button ...you are in control. You woudl only hit the real submit button (programmatically of course) if the user said yes. When they choose no you will not have to cancel the submit because it was never hit and hence the message will never appear.

Make sense?

Paul

Avatar

Former Community Member

ya Paul, but the click event of the fake button is not getting executed at all.

Can I will send my sample LCA file to your mail id ?

Regards,

Chalukya.