Disable Submit in infopath

J

JoeAtPMHCC

Is there a way to prevent to disable the submit button based upon the value
of a certain field? In my app data is populating the form from a variety of
sources, so the form seems 'edited' to infopath even though the user either
has no enterable fields or has done nothing interactive. I would really like
to know how to programatically control the enable/disable submit options.
 
S

Scott L. Heim [MSFT]

Hi Joe,

If you only have a small number of fields that you want to be sure are
completed, you can add a button to your form with a "Rule" to execute the
submit. The rule you create would have a condition applied so it would only
execute based on the condition being true.

If there are a number of fields you want to insure are completed, you can
still use the button but you would need to write some custom script to
"test" each field to insure they are completed as you need. Once they are,
you would simply call the "submit" method:

XDocument.Submit();

Lastly, if you use a button to execute the submit via a rule or custom
code, you can remove the "submit" functionality from the menu/toolbar by
disabling this option under Tools->Submitting Forms.

I hope this helps!

Scott L. Heim
Microsoft Developer Support

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

JoeAtPMHCC

Thank you very much for your fast response!
This does help, but I guess there is no way to use code to functionally
execute
the options under Tools->Submitting Forms?
This would be a big help in my case since this is one of many forms withing
my app
and I'd rather not have buttons or a different UI for only one form.
Thanks again,
Joe
 
S

Scott L. Heim [MSFT]

Hi Joe,

Correct - there is really not a method to control this at "runtime" (i.e.
turn this on or off) other than a process like what I previously described.

Best regards,

Scott L. Heim
Microsoft Developer Support

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