Submit and print with one button and rules

J

Jeffshex

I have a status report form. Is it possible to not only submit to the
database...but also if there hours for the week are under 35, to print it out
automatically?
I know this will need script... I just need an example or walk through to
help me out here.

Thanks!
 
S

Scott L. Heim [MSFT]

Hi,

You can use this code (vbscript) on the click event of your button:

XDocument.Submit
XDocument.Printout

** NOTE: This will require your form to be "Fully Trusted."

I hope this helps!

Scott L. Heim
Microsoft Developer Support

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

Jeffshex

I seen where I can click that over to Fully Trusted.
Is this a good or bad thing if I do that?
I'm not quite sure what "Fully Trusted" will get me into.

Thanks.
 
S

Scott L. Heim [MSFT]

Hi,

It means that you will either need to "digitally sign" your solution using
a digital certificate or create an installable package (using the Regform
tool from the InfoPath SDK) that sets the form to "Full Trust" and then
each user will need to install your form.

Here is some additional information that you may find of interest:

Understanding Fully Trusted Forms
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/
ipsdkUnderstandingFullyTrustedForms.asp

Using the Form Registration Tool
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipsdk/html/
ipsdkUsingTheFormRegistrationTool.asp

InfoPath SDK
http://www.microsoft.com/downloads/details.aspx?FamilyId=351F0616-93AA-4FE8-
9238-D702F1BFBAB4&displaylang=en

I hope this helps you!

Best Regards,

Scott L. Heim
Microsoft Developer Support

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

Jeffshex

Is this code going to print out everything though? Or am i able to throw on
a statement to print only forms less than 35 hours?

Thanks again.
Your help is greatly appreaciated.
 
S

Scott L. Heim [MSFT]

Hi,

This is going to print everything that is on the View. As such, you will
need to control what appears on the view. Keep in mind, this is doing the
same thing as manually executing the print. So if your current view works
fine, then you don't need to change anything other than using code to
execute the submit and print.

Scott L. Heim
Microsoft Developer Support

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

Jeffshex

Scott,

It's ok if i print everything on view, i'm not worried about that. I have a
field at the bottom of the form called WeekTotal. Every form should submit
(like it normally does), but I guess i'm wanting the code to say something
like: "Print only if WeekTotal < 35".

Thanks again.
 
S

Scott L. Heim [MSFT]

Hi,

Then in that case, you should be able to place the call to print in an "If"
test - use the "selectSingleNode" method to get a reference to that control
and then if the value is < 35, call the PrintOut method.

Scott L. Heim
Microsoft Developer Support

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

JB

This is exactly what I want done. However I don't know how to create the
script on the button. I tried the below code but no luck.

XDocument.Submit
XDocument.Printout

How do I insert the above code?
 

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