Translate VBScript to JScript for InfoPath form? RRS feed

  • Question

  • Please let me know if this is not an acceptable post for this forum. IN our environment, we have INfoPath developers that use code-behind in VBScript and JScript. I know VBScript really well, but am still learning JScript. Would someone mind translating the following VB to JScript? It's for a submit on_click event.
    Sub btnSubmit_OnClick(eventObj)
    	' trap errors before submit
    	If XDocument.Errors.Count = 0 then	'no errors 
    	    ' submit, set status, send notifications, and close form
    	    XDocument.DOM.selectSingleNode("//my:IsSubmitted").Text = "true"
    	    errMsg = "Your form is not complete. Required fields are indicated by a red asterisk or dashed border." 
    	    'msgbox XDocument.Errors(0).ShortErrorMessage & " - " & XDocument.Errors(0).Node.xml	'uncomment for debugging
    	    msgbox errMsg, vbOKOnly+vbInfo, "Form Error"
    	    'msgbox err.Description	'uncomment for debugging
    	End if
    End Sub
    Friday, July 31, 2009 9:23 PM