Hello and welcome to our community! Is this your first visit?
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
    Nov 2009
    Thanked 0 Times in 0 Posts

    Sending Input to a hidden box

    Hey all. Very Greenhorn coder here. Enough to have any idea where to look and to try things.

    I am trying to get the below to go into two table

    <p class="input">
    <label for="username"><?php echo $this->translate('Username');?> <br class="hide" /></label>
    <span class="field"><input type="text" name="username" id="username" value="<?php echo $this->username;?>" /></span>
    <span class="addtext"><?php echo $this->baseUrl;?>username</span>
    <p class="input">
    <label for="firstname"><?php echo $this->translate('Screen Name');?> <br class="hide" /></label>
    <span class="field"><input type="text" name="firstname" id="firstname" value="<?php echo $this->firstname;?>" /></span>
    What I essentially want to happen is hide the Screen Name section, but have whatever is typed into the Username box, be auto-copied to the Screen Name box (while its hidden).

    The other method that would work, would be to tell mySQL to copy anything from table A to table B. However, I am having more issues trying to figure out the mysql function for this, so thought I would try working on things from the front end.

    Any ideas? Or am I way off on this?

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Thanked 998 Times in 995 Posts
    This works when you click OUT of the input box. There are other ways of doing this.
    <!DOCTYPE html>
    <title>Title of the document</title>
    <style type="text/css">
    <label for="username">Full Name Please</label>
    <input type="text" name="username" id="username" onblur="show();">
    <div id="hide">
    <label for="firstname" style="float:left;">Your First Name</label>
    <input type="text" name="firstname" id="firstname" value="" style="float:left;">
    <script type="text/javascript">
    function show(){
    	did = document.getElementById("username").value;
    	document.getElementById("firstname").value = did;
    	document.getElementById("hide").style.display = "block";

  3. #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,947 Times in 4,908 Posts
    Pardon me for butting in, but...

    The other method that would work, would be to tell mySQL to copy anything from table A to table B.
    I have to wonder about your DB design if you have two tables involved for such simple data as user name and screen name. You might want to pose in the MySQL forum and show your DB design and ask for advice.
    Be yourself. No one else is as qualified.


Posting Permissions

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