Populate hidden field with javascript?
Last Post 09-03-2013 06:25 AM by Ryan Bakerink. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages Not Resolved
L PUser is Offline
new to the springs
new to the springs
Posts:1
Avatar

--
08-29-2013 10:10 AM
    Here is what I'm trying to accomplish:

    A visitor comes to the site with 2 querystring parameters (for ad tracking). A cookie gets created with those 2 parameters. They visit a page that has Dynamic Forms on it. 

    If they still have the parameters on the URL, those values get passed to hidden fields on the form.
    OR 
    If they have no parameters on the URL, then the values from the cookie get filled into the hidden fields on the form (if one exists).
    OR
    If no cookie exists and no parameters exist, then keep hidden fields on form blank.

    I was thinking of using Javascript baked into my skins on every page to read the URL, create the cookie, do comparisons, etc...then populate the hidden fields on the form with the correct value...but how do I do that? I don't see any type of id or class (in Firebug) that I can "grab" onto for hidden fields on the form. 


    Version info: 4.10.4.23731 / 6.0.2

    If there is a better way, please let me know. I tried playing with the "Retrieve values from querystring variable for this question" and "Retrieve values from cookie variable for this question"...but how do I introduce logic that says if the querystring exists, use those values instead of the cookie?
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    09-03-2013 06:25 AM
    Hello L P,

    Dynamic Forms assigns ID's and Name's to all form fields. The ID of a Hidden field will contain the short field name. So you can always view the page source and search for the short field name of the question you're looking for.

    The ID's and Name's of a field will contain a GUID, Module ID, and the short field name. So this is quite a large string.

    This method was adapted to ensure that duplicates of HTML Id's and Name's wouldn't be possible.


    Based on your last question:

    "..but how do I introduce logic that says if the querystring exists, use those values instead of the cookie?"

    JavaScript has a multitude of ways to detect Querystring variables, cookie variables, etc.. you'll just need to research how.

    The logic is:

    IF Querystring != ''
    BEGIN
    USE Querystring Value
    END

    ELSE
    BEGIN
    USE Cookie Value
    END


    This is how you can detect a Querystring in a URL using JavaScript:
    1.) http://stackoverflow.com/questions/...javascript
    2.) http://stackoverflow.com/questions/...ent-on-url

    You can build a script and inject this into the Initial JavaScript section of your Dynamic Form.

    Please let me know if you have any questions.

    Thanks,

    Ryan


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi