Substr JScript - InfoPath Dev
in

InfoPath Dev

Substr JScript

Last post 12-14-2006 07:43 AM by Matt Faus. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-08-2006 01:29 AM

    Substr JScript

    Hi,

    sorry for my bad english...
    my problem is :


    var date = XDocument.DOM.selectSingleNode("//my:date1");
    var annee = date.substr(0, 4);


    the error is :

    Object doesn't support this property or method


    I don't understand...
    Help please...

    Thanks !
  • 12-08-2006 01:45 AM In reply to

    Hi Diabloche,
    Date isn't a string. You need a date.TextNode.substr or something like that (I forget the string object underneath but Intellisense should remember for you).
    Patrick Halstead
    Project Manager at Qdabra
  • 12-08-2006 02:30 AM In reply to

    Thanks for your reply,
    I work in the script editor, i don't have an intellisense


    XDocument.UI.Alert(XDocument.DOM.selectSingleNode("//my:date1").TextNode);


    Why the string is empty ? I don't understand... does not post anything...
  • 12-14-2006 07:43 AM In reply to

    Hi diabolche,

    Try this:

    var date = XDocument.DOM.selectSingleNode("//my:date1").text;
    var annee = date.substring(0, 4);

    http://msdn2.microsoft.com/en-gb/library/3cz15ahb.aspx

    I feel your pain on working in script editor without Intellisense - oh the agony!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.