Prepopulate a hidden or better visible text field with Javascript output?

  • kotzilla
    Asked on October 23, 2014 at 9:33 PM

    Dear support,

    We are specialist plant nursery with a very basic but good enough javascript shopping cart that doesn't allow a proper checkout (ISP has no PHP or whatoever).

    All it does is to write the contents nicely arranged on the screen and the customer will copy and paste it into an e-mail himself. Sort of embarrassing :-)

    Now it seems Jotform might be a good solution.

    I created a nice form collecting all the address and contact data and it would be nice to prepopulate one large text field with the shopping cart contents above and include it into the jotform submit-e-mail.

    The shopping cart appears with the following command on our website and generates about 6-20 lines of text:

        <SCRIPT>

            CheckoutCart();

     

        </SCRIPT>

     

    Now, how to get the output of that script into a Jotform textbox (perfect would be visible but not editable, but hidden would be ok as well). We don't need any online payments, as the cart is still subject to verification (live plants!).

    Thanks a bunch!

    Volker

    PS: The website link doesn't show the jotform yet (source code commented out) as it is in active use by our customers.

  • Ashwin JotForm Support
    Replied on October 24, 2014 at 1:04 AM

    Hello Volker,

    I am not sure if I have understood your question correctly.

    What does the script code return? Is it an HTML or normal text content or it returns an array object? I did try to check your website for more understanding but could not find any checkout option there. 

    If your script code returns text then you can take advantage of our "URL parameter" feature to pre-populate any of your JotForm fields. The following guide should help you on how to use URL parameter:  http://www.jotform.com/help/71-Prepopulating-fields-to-your-JotForm-via-URL-parameters 

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!

  • Ashwin JotForm Support
    Replied on October 24, 2014 at 1:06 AM

    Hello Volker,

    I also wanted to update you that calling the "Checkout" function needs to be done in your own web page and the use the URL parameter to pre-populate the form fields. Please be noted that it is not possible to add any sort of script code in your form editor.

    Thank you!

  • kotzilla
    Replied on October 24, 2014 at 1:15 AM

    Hi Ashwin,

    That's the problem. I am very inexperienced with Java script, just putting ready made things without perfect understanding together.

    So for the output type I am not sure :-)

    Maybe you can go to the website, click the 'visit plants' button and then use the pink shopping cart button to get to the check-out. The jot-form is also already there.

    I saw the link that you provided earlier, but didn't fully understand it.

    Thanks for your help!

  • kotzilla
    Replied on October 24, 2014 at 1:22 AM

    Prepopulate a hidden or better visible text field with Javascript output? Image 1 Screenshot 20

     

  • kotzilla
    Replied on October 24, 2014 at 1:56 AM

    PS: I am not using the automated Jotform thing, but got the source code and pasted it into my html and did also the fine adjustment in the midst of my HTML file.

  • Ashwin JotForm Support
    Replied on October 24, 2014 at 3:17 AM

    Hello kotzilla,

    Thank you for the information on how to check your checkout page. 

    I am not sure if it is possible to dynamically read the data and pre-populate the JotForm field. I will play with your form and shopping cart and see if there is any possibility or workaround available. 

    I cannot assure if if that would be possible not I can give you an ETA on this but I will get back to you with an answer soon.

    Thank you!

  • kotzilla
    Replied on October 24, 2014 at 5:10 AM

    Hi Ashwin,

    Thanks for taking the time - I am very grateful. I seems as if it is just a small step lacking to the perfect solution.

    Will also try to further understand and learn about it :-)

    Thanks,

    Volker

  • Ashwin JotForm Support
    Replied on October 24, 2014 at 6:18 AM

    Hello Volker,

    You are welcome.

    I will get back to you on this soon.

    Thank you!