Change Script language

R

Ryan Miller

I made the mistake of clicking the "Edit Form Code" button in a form before
changing the default script from jscript to vbscript.

I've changed it now, but everything keeps opening in jscript by default. Is
there anyway to fix this without recreating my form?

Thanks,
-Ryan
 
A

Andrew Ma [MSFT]

You can extract your the files and manually edit them. In the manifest.xsf
file, you will find an <xsf:scripts> tag. Remove this and you will be able
to select another language.
You might want to clean up the .js files too, but you don't have to.

--
Andrew J. Ma
Software Test Engineer
Microsoft Office InfoPath
http://blogs.msdn.com/ajma
---------------------------------------
This posting is provided "As Is" with no warranties, and confers no rights.
Use of any included script sample are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Please do not send email directly to this alias. This alias is for
newsgroup purposes only.
 
R

Ryan Miller

Awesome, Thanks!
Funny, I did about 50 complicated searches yesterday trying to find the
answer - any search with 'script' in it seems to be a bad move. After
reading your post, I googled "infopath extract" and came up #1 with the
following article: http://support.microsoft.com/default.aspx?kbid=828853 .

Thanks,
-Ryan

Here's the text:
Important The following steps remove any existing script from your form
template. To successfully change your scripting language after you have
started Script Editor for your form template, you must complete all the
following steps.
1.. Make a backup copy for your InfoPath form template (.xsn file).
2.. Open your template in Design mode in InfoPath.
3.. On the File menu, click Extract Form Files.

The Browse for Folder dialog box appears.
4.. Select the folder that you want to extract the form files to, and then
click OK.
5.. Close your form template.
6.. To modify Manifest.xsf, follow these steps:
1.. Start a text editor such as Notepad, or start an XML editor such as
Visual Studio .NET. Open Manifest.xsf that is located in the folder where
you extracted your form files.
2.. Locate and then delete the following section:
<xsf:file name="script.js">
<xsf:fileProperties>
<xsf:property name="scriptType" type="string"
value="userEvents"></xsf:property>
</xsf:fileProperties>
</xsf:file>3.. Locate the xsf:solutionProperties node, and then delete
the scriptLanguage attribute.

For example, if your InfoPath form currently uses JScript for the script
language, the xsf:solutionProperties node will read as follows:
<xsf:solutionProperties scriptLanguage="jscript"
fullyEditableNamespace="http://schemas.microsoft.com/office/infopath/2003/my
XSD/2003-09-10T17:55:25" lastOpenView="view1.xsl"></xsf:solutionProperties>
After you delete the scriptLanguage attribute, thexsf:solutionProperties
node will read as follows::
<xsf:solutionProperties
fullyEditableNamespace="http://schemas.microsoft.com/office/infopath/2003/my
XSD/2003-09-10T17:55:25"
lastOpenView="view1.xsl"></xsf:solutionProperties>4.. Locate and then delete
the following section:
<xsf:scripts language="jscript">
<xsf:script src="script.js"></xsf:script>
</xsf:scripts>
5.. Save your changes to Manifest.xsf, and then close Script Editor.
7.. In Microsoft Windows Explorer, right-click Manifest.xsf, and then
click Design.

Your template opens in Design mode in InfoPath.
8.. On the File menu, click Save.
9.. To set your preferred script language, follow the steps in the "Change
the Script Language for Your Form Template" section.
 

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