Auto-Populating fields on Infopath form from asp page - InfoPath Dev
in

InfoPath Dev

Auto-Populating fields on Infopath form from asp page

Last post 10-29-2009 09:59 AM by Jason_2009. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 09-30-2009 07:30 AM

    Auto-Populating fields on Infopath form from asp page

    I have a infopath form that gets opened from an .asp page when one clicks on a image.  

    I need three fields to autopopulate when opening form.  (Item Name and two price fields)

    The situation is the asp page is a display of our company store items.  When you click on the image I need my form to populate the name of the item they clicked on as well as an employee price and customer price.  Form is then submitted to form library. 

    The asp page is a basically a data connection to a picture library in Sharepoint using SPDataSource. 

    So I have a data connection on the form to the asp page, and I have assigned the default value of the Item field to a value of "@Title" so it is actually returning a value but it doesn't give me the name of the item that was clicked on, just the first item in the list. 

    How can I get it to give me the current item and price?

    Also from the asp page I am sending from the link, the item name and price.  So when you hover over the image the link shows as

    (http://servername/page/template.xsn?@title=CurrentItem&@Employee_Price=CurrentPrice)  Not sure if this is needed.

     Not sure how to grab the selected info and add to form.  

     

    Any help is greatly appreciated.  

    Thanks 

     

     

     

  • 09-30-2009 10:22 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

     I'm guessing I would have to write some OnLoad event?

  • 09-30-2009 11:02 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

    If you are passing in values as parameters to your IP form, the IP form will need some onload code to take the data from those params and put it in the appropriate fields. Here is an InfoPath Team blog post on using input parameters with InfoPath.

    Hilary Stoupa

  • 09-30-2009 11:23 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

     Awesome,

    Thanks a lot for the link!

  • 09-30-2009 11:36 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

    I don't know if the bug I mention in this blog post has been fixed, but do watch out for case sensitivity!

    Hilary Stoupa

  • 10-01-2009 10:13 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

    I am getting an error 

    '[email protected]' is null or not an object

    File:script.js

     

    I just installed InfoPath 2007 as I was worried that the error was being caused because I was using 2003.  

    Not sure why I am getting this. 

     

    Here is the onlaod event :

    function XDocument::OnLoad(eventObj)

    {

       var Item = eventObj.XDocument.InputParameters["@Title"].value;

       eventObj.XDocument.UI.Alert(Item);

    } 

     

  • 10-01-2009 11:43 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

    Parameters are new for IP 2007 and don't work with IP 2003 or the IP 2003 object model.

    Hilary Stoupa

  • 10-01-2009 11:45 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

     So should I just recreate the form using 07?

  • 10-01-2009 12:47 PM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

    That's one way. qRules 1.8 supports input parameters, so you don't have to write code if you don't want to. Opening one form with values from another form is easy as pie.

    For 2003, you have some options: use merge forms functionality - see Jim Cantwell's blog on this http://www.infopathdev.com/blogs/jim/archive/2005/09/14/Pass-Parameters-to-InfoPath.aspx which requires code. You can also start a new form with an XML file but that requires data sources match.

    Patrick Halstead
    Project Manager at Qdabra
  • 10-01-2009 12:54 PM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

     @Patrick

     

    I am passing the values through URL though, so I think there should be some onLoad event code to assign values to my controls...right?

  • 10-29-2009 09:59 AM In reply to

    Re: Auto-Populating fields on Infopath form from asp page

     So I don't believe that I am having any trouble getting the parameters.

    The problem I am having is assigning those values to the infopath controls. 

    The control names are item & price. 

     

     

Page 1 of 1 (11 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.