Jump to content

Recommended Posts

I'm not too familiar with java, i know what it can do but I'm not that good with it, I'm more into php. Anyways, I have 2 radio buttons:

1) Ship to address listed above <selected>
2) Ship to this address

How would I make it so when a person changes to "ship to this address", the fields to enter a new address will show up?

a demo of what the two radio buttons, and form below to show up are at:
[a href=\"http://www.jwelchdesign.com/ao/book/onchange.php\" target=\"_blank\"]http://www.jwelchdesign.com/ao/book/onchange.php[/a]

the code for the form:
[code]<form>
<input name="dvd_ship" type="radio" id="dvd_ship" value="same" checked>Ship to address listed above<br>
<input name="dvd_ship" type="radio" id="dvd_ship" value="new">Ship to this address:
<br>
<br>
ADDRESS:<br>
<input name="dvd_shipping_address" type="text" id="dvd_shipping_address" size="25">
<br>
<br>
City<input name="dvd_shipping_city" type="text" id="dvd_shipping_city" size="15">
<select name="dvd_shipping_state" class="mainText" id="dvd_shipping_state">
    <option value="State">St </option>
    <option value="Oregon">OR </option>
    <option value="Washington">WA </option>
    <option value="California">CA </option>
    <option value="Idaho">ID</option>
    <option value="Colorado">CO</option>
    <option value="Nevada">NV</option>
</select>
ZIP<input name="dvd_shipping_zip" type="text" id="dvd_shipping_zip" size="8">
</form>[/code]
Link to comment
https://forums.phpfreaks.com/topic/7130-onchange-show-table-help/
Share on other sites

Something like this should do the trick:
[code]<script type="text/javascript">
function showHide(inID) {
    theObj = document.getElementById(inID);
    theDisp = theObj.style.display == "none" ? "block" : "none";
    theObj.style.display = theDisp;
}
</script>

<form>
<input name="dvd_ship" type="radio" id="dvd_ship" value="same" onChange="showHide('ship_addy')" checked>Ship to address listed above<br>
<input name="dvd_ship" type="radio" id="dvd_ship" value="new" onChange="showHide('ship_addy')">Ship to this address:<br>
<br>
<div id="ship_addy" style="display: none">
ADDRESS:<br>
<input name="dvd_shipping_address" type="text" id="dvd_shipping_address" size="25"><br>
<br>
City<input name="dvd_shipping_city" type="text" id="dvd_shipping_city" size="15">
<select name="dvd_shipping_state" class="mainText" id="dvd_shipping_state">
    <option value="State">St </option>
    <option value="Oregon">OR </option>
    <option value="Washington">WA </option>
    <option value="California">CA </option>
    <option value="Idaho">ID</option>
    <option value="Colorado">CO</option>
    <option value="Nevada">NV</option>
</select>
ZIP<input name="dvd_shipping_zip" type="text" id="dvd_shipping_zip" size="8">
</div>

</form>[/code]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.