Announcement

Collapse
No announcement yet.

Pass ProductCode from Page to Form Field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Pass ProductCode from Page to Form Field

    I hope someone can help me. I have had a look around the other posts and this has been spoken about, but in a language way above me. Hopefully, someone can tell me what to do step by step?

    I am trying to find a way to pass the ProductCode variable in Actinic from a catalog page into a form field on another page (i.e. autocomplete the productcode section of the form). Is there a way to do this? And, if so, how do you do it? I don't use JavaScript, as I don't know how, so if this would normally be accomplished with JavaScript, can someone please state (in very simple terms) how to use it?

    Any help is appreciated. Thanks in advance.

    #2
    This previous thread discusses something similar:

    http://community.actinic.com/showthr...ght=javascript

    The final post there has pretty much everything you need. It is passing the product name to the form using NETQUOTEVAR:PRODUCTNAME; since you want to pass the product code, you should replace that with NETQUOTEVAR:PRODUCTREFERENCE.
    www.gbradley.co.uk
    Web Development, Actinic Patches, Scripts & more

    Comment


      #3
      Thanks very much!

      Comment


        #4
        I tried to use your code on the other post, but the form just kept filling with "NETQUOTEVAR:PRODUCTREF", rather than the actual product ref.

        I copied your code exactly.

        Is this happening because the page has already generated, and so the variable isn't there? As I said, I don't really know what I'm doing .

        Any help to get this working would be really appreciated.

        Thanks.

        Comment


          #5
          Think I found why this doesn't work. I was trying to use the PRODUCTREFERENCE variable from a template that forms the outside of the product page, rather than the product page template itself.

          Is there anyway to pass the product code under these circumstances?

          Comment


            #6
            To make the variable accessible in every page, you could do this:

            Open up your actual product template (Act_ProductLine or similar) and add the following to the very bottom of the template:

            Code:
            <input type='hidden' id='productcode' value='NETQUOTEVAR:PRODUCTREFERENCE'>
            This saves the product reference into a hidden form field, which Javascript can access. Save and close that template. Now alter the image link HTML on your other template to this:

            Code:
            <a href="javascript:goToForm()"><img src="button.gif" /></a>
            The link now fires a javascript function when it is clicked. Finally add this to the bottom of the template:

            Code:
            <script type="text/javascript">
            
            function goToForm(){
            var pCode=document.getElementById("productcode").value;
            window.location="contactform.html?p="+pCode;
            }
            
            </script>
            This function grabs the product code from the hidden form field, adds it to the destination URL and then takes the user there. Save and close, and it should now work.
            www.gbradley.co.uk
            Web Development, Actinic Patches, Scripts & more

            Comment

            Working...
            X