Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Building Hyperlinks from Form Field Entry

    I need to create a page where a user enters text into a form field like campaign_id and selects "Generate". Once doing so, a series of hyperlinks on the page would be appended as follows: http://www.domain.com?campaign_id=value

    Can anyone provide assistance or point me in the direction of a resource?

  • #2
    Regular Coder oVTech's Avatar
    Join Date
    Nov 2010
    Location
    USA
    Posts
    296
    Thanks
    4
    Thanked 54 Times in 52 Posts
    Quote Originally Posted by kinron View Post
    I need to create a page where a user enters text into a form field like campaign_id and selects "Generate". Once doing so, a series of hyperlinks on the page would be appended as follows: http://www.domain.com?campaign_id=value

    Can anyone provide assistance or point me in the direction of a resource?

    Check out these links:
    http://www.codingforums.com/archive/...p/t-74664.html
    http://www.codingforums.com/archive/.../t-179100.html
    http://www.webmasterworld.com/forum91/4044.htm
    http://www.dynamicdrive.com/forums/s...ad.php?t=49108



    Good luck!




    I don't know, I don't care, and it doesn't make any difference!
    -Albert Einstein-




  • #3
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts
    http://www.tizag.com/javascriptT/
    If you don't require any server side assistance, Javascript could do this very easily. Something like this:

    Code:
    <form>
    <fieldset>
    <label for="textin">Text:</label><input type="text" id="textin" name="textin" />
    <input type="button" onclick="document.getElementById('url').innerHTML=document.getElementById('textin').value" />
    </fieldset>
    </form>
    
    <textarea rows="1" cols="20" id="url"></textarea>
    That's the basic idea. Your button activates a string of Javascript code. document.getElementById is used to get an element by its ID, in this case, the id is 'url'. innerHTML refers to the HTML code between the opening and closing tags of that element. value refers to the attribute 'value' which will be the text entered into the input box 'textin'. This function sets the inner HTML of 'url' to the value of 'textin'. A little more code might be necessary if you want to append the value of textin to a preset URL, but a quick readthrough of a Javascript tutorial and you should have no problem doing that yourself.
    "Yeah science!"
    Online Science Tools


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •