Convert to JScript help - InfoPath Dev
in

InfoPath Dev

Convert to JScript help

Last post 03-08-2007 12:00 AM by K.Ramana Reddy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-06-2007 01:37 PM

    Convert to JScript help

    Can anyone help me out in converting the following VBScript to JScript? :-If not can you give me some tips on how to learn how to convert from 1 language to another?


    Sub CTRL2_5_OnClick(eventObj)
    Dim txtPath
    Dim txtName
    Dim GMSRef

    GMSRef = XDocument.DOM.selectSingleNode("my:myFields/my:field2").text
    txtPath = "Z:\My Documents\InfoPath Forms\"
    txtName = ".xml"

    XDocument.SaveAs(txtpath & GMSRef & txtName)


    thisXDocument.Application.Close(true)
    End Sub


    Thanks for ANY help!!!
  • 03-06-2007 09:37 PM In reply to

    Re: Convert to JScript help

    Hi,

    Only we have to change SUB to function, every end of statement we have to give ; and we have to declare data types int,string and ... instead of Dim.

    check this this code, it will help you,

    function CTRL2_5::OnClick(eventObj)
    {
    string txtPath;
    string txtName;
    string GMSRef;

    GMSRef = XDocument.DOM.selectSingleNode("my:myFields/my:field2").text;
    txtPath = "Z:\My Documents\InfoPath Forms\";
    txtName = ".xml";

    XDocument.SaveAs(txtpath & GMSRef & txtName);


    thisXDocument.Application.Close(true);

    }

    I hope this will help you.
    K.Ramana Reddy / http://www.ggktech.com
    India.
  • 03-07-2007 07:15 AM In reply to

    Re: Convert to JScript help

    Thanks for your help!
    I'm receiving this error now:
    "InfoPath cannot open the selected form because of an error in the form's code.
    The following error occurred:

    Expected ';'
    File:script.js
    Line:24
    string txtPath;"

    Line 24 is the 1st line of code:
    "string txtPath;"

    Any ideas why this is happening?

    Thanks again!
  • 03-08-2007 12:00 AM In reply to

    Re: Convert to JScript help

    Hi, sorry for my mistake,

    Change the string to var,
    var txtPath;
    var txtName;
    var GMSRef;

    I hope it will work for you.
    K.Ramana Reddy / http://www.ggktech.com
    India.
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.