Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

text input field

Options
  • 29-07-2006 3:24pm
    #1
    Registered Users Posts: 2,593 ✭✭✭


    hi guy's

    sorry i know this is a silly question but an cr** at web programming and i have done a few google's on this and am still stumped

    basically what i am looking to do is when a text input box has been filled i need to assigned that value to a hidden field on the form

    currently my area that the text is inputted into is
    Name:<br><input type="text" name="realname" value="your name" size="20">

    now i want to assign the value of that to a hidden field like
    <input type="hidden" name="subject" value=" the value of realname to be placed ere" />


    i know it must be just something simple

    thx in advance


Comments

  • Registered Users Posts: 872 ✭✭✭grahamor


    you could use onBlur to call a javascript function. onBlur fires when the user clicks out of the textbox ( you could use other commands aswell i think)

    <input type="text" name="realname" value="your name" size="20" onBlur="javascript:assign();">

    then at the top of the page in a script block

    function assign(){
    document.getElementById("hiddenFieldID").value = document.getElementById("realname").value;
    }

    my syntax might be a bit wrong but its the idea i think

    hope it helps.


  • Closed Accounts Posts: 2,046 ✭✭✭democrates


    I'm stumped as to why you want to do this. The value is going to be duplicated on a second form field, both will be sent to the server on submission, both are trivial to hack, what do you gain for this extra work apart from requiring the user to enable javascript?


  • Registered Users Posts: 2,593 ✭✭✭tommycahir


    i got it going aqctually shortly afterwards but not exactly the way i would have liked it but it going none the less

    thx for help anyways


  • Closed Accounts Posts: 2,046 ✭✭✭democrates


    I just want to make sure you know that a hidden field provides no security, assigning something to that won't stop a person saving the page, manually changing the values in all form fields, and submitting any values they like to your server.


Advertisement