Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is there a way to add either Javascript or additional css rules to InfoPath forms that are generated by the forms server in SharePoint 2010 or 2013?

share|improve this question
    
I can recommend you Forms Designer (spform.com) tool. It allows to create custom forms with your own javascript and css directly in the browser. But it's not free. –  Dmitry Kozlov Jan 29 '13 at 8:59
add comment

2 Answers

up vote 2 down vote accepted

As a side-off note, Infopath 2003 used JS for code-behind though probably it wouldn't help you in any way since, I guess, you one should understand that Infopath forms are not HTML or web pages, they are XML data to be used by external tools, like for example Sharepoint Server IPFS - Infopath Forms Service, to generate web pages on the basis of XSN Infopath form template, while the data, in case of sharepoint library Infopath forms, is stored in Infopath XML data forms.

Please check:

If to guess a little further what you rellay ask and go outside of OOTB then you might find helpful:

Is there a way to add either Javascript or additional css rules to InfoPath forms that are generated by the forms server in SharePoint 2010 or 2013?

As it was answered before, it is possible to use C# or VB.NET in Infopath 2010 or 2013, unless it is Sharepoint List Form type where code-behind is not possible at all, and one cannot add OOTB CSS rules neither to Infopath XML data forms not to XSN Infopath form templates.

If you want to go non-OOTB and unintended ways, please check:

And if to go in intended and unproblematic way, then check:

share|improve this answer
add comment

If you are using a browser-based form you can only edit the form code using C# .NET or VB .NET. In InfoPath 2010, there should be a "Developer" tab where you can edit the code (using the "Code Editor" button). If you have to use Javascript, you could also try to call the script indirectly, using the method here:

http://blogs.msdn.com/b/infopath/archive/2005/06/17/430347.aspx

But you should review your requirements to see if Javascript is necessary and if you can't do the same with the OOTB methods.

share|improve this answer
    
The blog post is very helpful, thanks. –  Larry K Jan 30 '13 at 20:21
    
Glad I could be of assistance. You should accept my answer if it helped you. –  Alex Jan 30 '13 at 21:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.