AutoFill - InfoPath Dev
in

InfoPath Dev

AutoFill

Last post 09-30-2004 12:08 PM by BrownR. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-17-2004 01:48 PM

    • BrownR
    • Top 200 Contributor
    • Joined on 08-14-2004
    • USA
    • Posts 54

    AutoFill

    Ok i have this script in my Onload function.

    function XDocument::OnLoad(eventObj)
    {

    var objWscript;
    //Pull the info from the machine
    objWscript = new ActiveXObject("WScript.Network");
    //Combine the login to the hidden text box.
    XDocument.DOM.selectSingleNode("//dfs:myFields/dfs:dataFields/d:ReportInfo/@Login").text= objWscript.UserName;

    }


    Im trying to get a textbox to autofill with the user sign in name. It does just that and works fine until they do a search/query or clicks on new form. It then turns blank and no longer has the users name in that spot. I would like it to have it at any time that name will be in the box. So if they open the IP and starts to add a file it will auto fill and if they query and then click on new record it will then also autofill.
  • 09-30-2004 10:26 AM In reply to

    Because you are doing a query, you are clearing out all the data that was stored previously under dsf:dataFields.

    The best thing for you to do is to store a copy of the user name in code, and then have an OnAfterChange event handler for the @Login field, which will populate it from the variable when it gets recreated (via query or anything else).

    Greg Collins [InfoPath MVP]
  • 09-30-2004 12:08 PM In reply to

    • BrownR
    • Top 200 Contributor
    • Joined on 08-14-2004
    • USA
    • Posts 54
    Thanks Greg. I just removed the "New Record" for the time being. It created a hassle with something else, that i cant remember so it'll be on the back burner for now. I have it set to make a new record everytime they open the form. Or do a search if they like.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.