dialog before submit

T

tmapola

Hi,

Is there any way to pop up a Yes/No dialog box before Submit so that
the form is only submitted if the user clicks "Yes"?

What I'm trying to do is have a button which asks the user if they are
sure they want to continue. If they click "Yes", it sets some field
values and then submits the form.

Thanks!
 
S

Scott L. Heim [MSFT]

Hi,

You can do this via custom code behind your "Submit" functionality. Once
you get the response from the user, populate your data and then call the
Submit method.

Thanks,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

tmapola

Thanks for your reply!

We tried what you suggested but it's not quite working. We have
created a data connection for submit that submits the form to a
SharePoint form library then closes the form. We have two buttons that
make use of this data connection.

The first button, called "Submit", has "Submit" as the action in the
button properties and it works properly (i.e. it submits then closes
the form).

The second button, called "Approve", has "Rules and Custom Code" as the
action. When the user clicks on the "Approve" button, we would like to
set the "state" field of the form then run the submit as normal (i.e.
submit and close). For our custom code we have:

function BTN_APPROVE::OnClick(eventObj)
{
var clicked = XDocument.UI.Confirm("Are you sure you want to Approve
this form?", 4);
if(clicked == 6)
{
var stateNode =
XDocument.DOM.selectSingleNode("/my:myFields/my:state");
stateNode.text = "Approved";
XDocument.Submit();
}
}

Everything works EXCEPT it doesn't close the form. Any suggestions?

Thanks again,
Tracy
 
S

Scott L. Heim [MSFT]

Hi Tracy,

If you want to just close the current InfoPath document, you can use the
following:

Application.XDocuments.Close(0);

However, if you want to close InfoPath entirely, use:

Application.Quit(false);

I hope this helps!

Best Regards,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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