close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

populate a text field upon a dropdown change

Thread began 5/17/2015 11:23 am by JBWebWorks | Last modified 5/19/2015 3:19 pm by JBWebWorks | 482 views | 2 replies

JBWebWorks

Thanks Ray,
I was actually able to figure it out by using the FirstName,LastName,GHIN_number in the player1 select options and hidden fields for each. And then JavaScript to populate the hidden fields with an on change calling the function when the person chooses from the select drop down.

My code

php:
<script type="text/javascript">

function setSatsignup(opts) {
    var optArray = new Array;
    optArray = opts.split(",");
    var theForm = document.form1;
    var prodNameField = theForm.FirstName;
    var prodName1Field = theForm.LastName;
    var prodGHINField = theForm.GHIN_number;
    prodName1Field.value = optArray[1];
    prodGHINField.value = optArray[2];
    prodNameField.value = optArray[0];
    

}
</script>

<div id="form1_ProgressWrapper">
<?php $selected explode(", "ValidatedField("index_225","player1")); ?><form  action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
    
      <label for="player1"><strong>Your Name:</strong></label>
      <select name="player1[]" id="player1" onchange="setSatsignup(document.form1.player1[document.form1.player1.selectedIndex].value)">
        <option value="" selected="selected">Select From Dropdown</option>
        <?php
do {  
?>
        <option value="<?php echo $row_rs_members['FirstName']?>,<?php echo $row_rs_members['LastName']?>,<?php echo $row_rs_members['GHIN_Number']; ?>"><?php echo $row_rs_members['FirstName']?> <?php echo $row_rs_members['LastName']?></option>
        <?php
} while ($row_rs_members mysql_fetch_assoc($rs_members));
  
$rows mysql_num_rows($rs_members);
  if(
$rows 0) {
      
mysql_data_seek($rs_members0);
      
$row_rs_members mysql_fetch_assoc($rs_members);
  }
?>
      </select>
      <?php
if (ValidatedField('index_225','index_225'))  {
  if ((
strpos((",".ValidatedField("index_225","index_225").","), "," "1" ",") !== false || "1" == ""))  {
    if (!(
false))  {
?>
        <span class="stylered">Name required</span>
        <?php //WAFV_Conditional index.php index_225(1:)
    
}
  }
}
?>
<br />

  <?php
if (ValidatedField('index_276','index_276'))  {
  if ((
strpos((",".ValidatedField("index_276","index_276").","), "," "1" ",") !== false || "1" == ""))  {
    if (!(
false))  {
?>
    <span class="stylered">You are already signed up for Saturday</span>
    <?php //WAFV_Conditional index.php index_276(3:)
    
}
  }
}
?>
<br />
      <label for="email1"><strong>Email Confirmation </strong></label>
      <select name="email1" id="email1">
        <option value="" <?php if (!(strcmp("", (ValidatedField("index_225","email1"))))) {echo "selected=\"selected\"";} ?>>Select your Name if you want an email confirmation</option>
        <?php
do {  
?>
        <option value="<?php echo $row_rs_members['EmailAddress']?>"<?php if (!(strcmp($row_rs_members['EmailAddress'], (ValidatedField("index_225","email1"))))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_members['FirstName']; ?> <?php echo $row_rs_members['LastName']?> </option>
<?php
} while ($row_rs_members mysql_fetch_assoc($rs_members));
  
$rows mysql_num_rows($rs_members);
  if(
$rows 0) {
      
mysql_data_seek($rs_members0);
      
$row_rs_members mysql_fetch_assoc($rs_members);
  }
?>
      </select>
      <br />
<br />

      <label for="tee1"><strong>Your Tee Choice:</strong></label>
      <select name="tee1" id="tee1">
        <option value="" selected="selected" <?php if (!(strcmp("", (ValidatedField("index_225","tee1"))))) {echo "selected=\"selected\"";} ?>>Select Your Tee</option>
        <option value="Gold" <?php if (!(strcmp("Gold", (ValidatedField("index_225","tee1"))))) {echo "selected=\"selected\"";} ?>>Gold</option>
        <option value="White" <?php if (!(strcmp("White", (ValidatedField("index_225","tee1"))))) {echo "selected=\"selected\"";} ?>>White</option>
        <option value="Blue" <?php if (!(strcmp("Blue", (ValidatedField("index_225","tee1"))))) {echo "selected=\"selected\"";} ?>>Blue</option>
      </select>
      <?php
if (ValidatedField('index_225','index_225'))  {
  if ((
strpos((",".ValidatedField("index_225","index_225").","), "," "2" ",") !== false || "2" == ""))  {
    if (!(
false))  {
?>
        <span class="stylered">Tee Required</span>
        <?php //WAFV_Conditional index.php index_225(2:)
    
}
  }
}
?>
<br />
      <br />
      <label for="pairing1"><strong>Pairing Request:</strong></label>
      <textarea name="pairing1" id="pairing1" cols="45" rows="5"><?php echo(ValidatedField("index_225","pairing1")) ?></textarea>
      <br />
      <br /><input name="FirstName" id="FirstName" type="hidden" value="" /><input name="LastName" id="LastName" type="hidden" value="" /><input name="GHIN_number" id="GHIN_number" type="hidden" value="" />
      <span><input type="submit" name="submit1" id="submit1" value="Submit Saturday Signup" /></span>
  </form>
</div>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...