/    Sign up×
Community /Pin to ProfileBookmark

Form Events?? ARGHH!!

I’m back!!! I figured out a couple more on my own, but this one is just kickin my butt. I can of course make the button etc..but they are supposed to make a pop up box as soon as they are checked…and this form…I don’t even know where to begin. I think I’m just getting soo overwhelmed I’m confusing myself. Any help again would be great!. Here’s my prob.

write appropriate html and js code to create a set of radio buttons named mailinglist with the values Optin and Opt out. Label them I’ll pass and Sign me up. When the visitor clicks either of the radio buttons, a confirm dialog should pop up verifying that the visitor really inteded to make that choice. If the visitor clicks cancel don’t set the button, if the visitor clicks OK, set the buttton. I have the buttons obviously just need the fuction or what not to get the pop up.
<html>
<head>
<title>Radio Buttons</title>
<body>
<form name=”formbuttons”>
<input type=”radio” name=”MailingList” value =”Opt In”> Sign me up!
<input type=”radio” name=”MailingList” value =”Opt out”> I’ll pass!
</form>
</body>
</head>
</html>
Then after that I am supposed to make a form..uggghhh….completely lost on this on. Haven’t even attempted to start the form cause of all the other that is required. Can find nothing about this, or i’m looking for the wrong help. I am to create a form with 2 sets of fields for name, address, city, state and zip under the headings billing address and shipping adress. Write the appropriate html and js code to create a checkbox labeled ship to billing. when the visitor clicks on the checbox to check it, confirm that he does indeed wish ship to the billing address provided. If he confirms by clicking OK, copy the billing data to the appropriate shipping fields. If he clicks cancel, do nothing. When the visitor clicks on the checkbox to clear the field, that is, remove the check, confirm that he wants to ship to an address other than the billing address. if he confirms, clear the shipping address field; otherwise leave them be. Any help would be WONDERFUL!!! I am getting very fustrated with all of this. ?

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@Brandoe85Dec 02.2004 — This should work for your radios, though you can change it to use a for loop if you ever use more than 2 radios, I just threw it together without one.

[code=php]
<script language="javascript">
function checkRadios()
{
var check = confirm("Are you sure");
if(check)
{
return true;
}
else
{
//can use a for loop here to uncheck them..
document.forms[0].MailingList[0].checked = false;
document.forms[0].MailingList[1].checked = false;
return false;
}
}
</script>
</head>
<body>
<form name="formbuttons">
<input type="radio" name="MailingList" value ="Opt In" onclick="return checkRadios();"> Sign me up!<br>
<input type="radio" name="MailingList" value ="Opt out" onclick="return checkRadios();"> I'll pass!
</form>
[/code]

Try the second part and post the code and ill be glad to help out...you'll find out it's really not too difficult at all...
Copy linkTweet thisAlerts:
@PandaQauthorDec 02.2004 — thanks. I'm sure I'll have no prob with the form, it's the code for it. I am very "duh" when it comes to programming, but it's required. Thanks for your help!
Copy linkTweet thisAlerts:
@PandaQauthorDec 02.2004 — OK, all I have so far is the html. I tired using the same functin as before for when I check the box but got nothing. And this was supposed to be easier for me than VB?! HAHA! Gonna get a tumor from all this I think! I think I might be able to figure out the alert for the check and uncheck (BIG MAYBE) but the copy or deleting of the text entered after the check or uncheck?!?! AHHHHH

<html>

<head>

<title>Mailing List</title>

<script language="JavaScript" type="text/javascript">

</script>

</head>

<body>

<h1>Billing Address</h1>

<form >

<table border=0>

<tr>

<th width="150" align="right" valign="bottom"></th>

</tr>

<tr>

<th width="150" align="right">Name:</th>

<td colspan="5">

<input name="Customer" type="text" size="27" maxlength="40"></td>

</tr>

<tr>

<th width="150" align="right">Address:</th>

<td colspan="5">

<input name="Address" type="text" size="45" maxlength="64"></td>

</tr>

<tr>

<th width="150" align="right">City:</th>

<td><input name="City" type="text" size="12" maxlength="12"></td>

<th align="right">State:</th>

<td>

<select name="State">

<option value="" selected></option>

<option value="AL">AL</option>

<option value="AK">AK</option>

<option value="AZ">AZ</option>

<option value="AR">AR</option>

<option value="CA">CA</option>

<option value="CO">CO</option>

<option value="CT">CT</option>

<option value="DC">DC</option>

<option value="DE">DE</option>

<option value="FL">FL</option>

<option value="GA">GA</option>

<option value="HI">HI</option>

<option value="ID">ID</option>

<option value="IL">IL</option>

<option value="IN">IN</option>

<option value="IA">IO</option>

<option value="KS">KS</option>

<option value="KY">KY</option>

<option value="LA">LA</option>

<option value="MA">MA</option>

<option value="MD">MD</option>

<option value="ME">ME</option>

<option value="MI">MI</option>

<option value="MN">MN</option>

<option value="MO">MO</option>

<option value="MS">MS</option>

<option value="MT">MT</option>

<option value="NC">NC</option>

<option value="ND">ND</option>

<option value="NE">NE</option>

<option value="NH">NH</option>

<option value="NJ">NJ</option>

<option value="NM">NM</option>

<option value="NV">NV</option>

<option value="NY">NY</option>

<option value="OH">OH</option>

<option value="OK">OK</option>

<option value="OR">OR</option>

<option value="PA">PA</option>

<option value="RI">RI</option>

<option value="SC">SC</option>

<option value="SD">SD</option>

<option value="TN">TN</option>

<option value="TX">TX</option>

<option value="UT">UT</option>

<option value="VA">VA</option>

<option value="VT">VT</option>

<option value="WA">WA</option>

<option value="WI">WI</option>

<option value="WV">WV</option>

<option value="WY">WY</option>

</select>

</td>

<th align="right"><b>Zip:</b></th>

<td>

<input name="Zip" type="text" size="9" maxlength="10"></td>

</tr>

<tr>

<th width="150" align="right">Phone:</th>

<td>

<input name="Phone" type="text" size="12" maxlength="12"></td>

</tr>

</table>

<br>

<input type="checkbox" name="shipto" value="Ship to billing address">Ship to billing address<br>

<h1>Shipping Address</h1>

<form >

<table border=0>

<tr>

<th width="150" align="right" valign="bottom"></th>

</tr>

<tr>

<th width="150" align="right">Name:</th>

<td colspan="5">

<input name="Customer" type="text" size="27" maxlength="40"></td>

</tr>

<tr>

<th width="150" align="right">Address:</th>

<td colspan="5">

<input name="Address" type="text" size="45" maxlength="64"></td>

</tr>

<tr>

<th width="150" align="right">City:</th>

<td><input name="City" type="text" size="12" maxlength="12"></td>

<th align="right">State:</th>

<td>

<select name="State">

<option value="" selected></option>

<option value="AL">AL</option>

<option value="AK">AK</option>

<option value="AZ">AZ</option>

<option value="AR">AR</option>

<option value="CA">CA</option>

<option value="CO">CO</option>

<option value="CT">CT</option>

<option value="DC">DC</option>

<option value="DE">DE</option>

<option value="FL">FL</option>

<option value="GA">GA</option>

<option value="HI">HI</option>

<option value="ID">ID</option>

<option value="IL">IL</option>

<option value="IN">IN</option>

<option value="IA">IO</option>

<option value="KS">KS</option>

<option value="KY">KY</option>

<option value="LA">LA</option>

<option value="MA">MA</option>

<option value="MD">MD</option>

<option value="ME">ME</option>

<option value="MI">MI</option>

<option value="MN">MN</option>

<option value="MO">MO</option>

<option value="MS">MS</option>

<option value="MT">MT</option>

<option value="NC">NC</option>

<option value="ND">ND</option>

<option value="NE">NE</option>

<option value="NH">NH</option>

<option value="NJ">NJ</option>

<option value="NM">NM</option>

<option value="NV">NV</option>

<option value="NY">NY</option>

<option value="OH">OH</option>

<option value="OK">OK</option>

<option value="OR">OR</option>

<option value="PA">PA</option>

<option value="RI">RI</option>

<option value="SC">SC</option>

<option value="SD">SD</option>

<option value="TN">TN</option>

<option value="TX">TX</option>

<option value="UT">UT</option>

<option value="VA">VA</option>

<option value="VT">VT</option>

<option value="WA">WA</option>

<option value="WI">WI</option>

<option value="WV">WV</option>

<option value="WY">WY</option>

</select>

</td>

<th align="right"><b>Zip:</b></th>

<td>

<input name="Zip" type="text" size="9" maxlength="10"></td>

</tr>

<tr>

<th width="150" align="right">Phone:</th>

<td>

<input name="Phone" type="text" size="12" maxlength="12"></td>

</tr>

</table>

</form>

</body>

</html>
Copy linkTweet thisAlerts:
@Brandoe85Dec 02.2004 — It's almost exactly like the previous one. Here it does the customer name for you, im sure you can figure the rest out...
[code=php]
<html>
<head>
<title>Mailing List</title>
<script language="JavaScript" type="text/javascript">
var shipTo = document.form1.shipto.checked;
function check()
{
var yes = confirm("Are you sure");
if(yes)
{
document.form2.Customer.value = document.form1.Customer.value;
return true;
}
else
{
shipTo = false;
return false;
}
}

</script>
</head>
<body>
<h1>Billing Address</h1>
<form name="form1">

<table border=0>
<tr>
<th width="150" align="right" valign="bottom"></th>
</tr>
<tr>
<th width="150" align="right">Name:</th>
<td colspan="5">
<input name="Customer" type="text" size="27" maxlength="40"></td>
</tr>
<tr>
<th width="150" align="right">Address:</th>
<td colspan="5">
<input name="Address" type="text" size="45" maxlength="64"></td>
</tr>
<tr>
<th width="150" align="right">City:</th>
<td><input name="City" type="text" size="12" maxlength="12"></td>
<th align="right">State:</th>
<td>
<select name="State">
<option value="" selected></option>
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DC">DC</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IO</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select>
</td>
<th align="right"><b>Zip:</b></th>
<td>
<input name="Zip" type="text" size="9" maxlength="10"></td>
</tr>
<tr>
<th width="150" align="right">Phone:</th>
<td>
<input name="Phone" type="text" size="12" maxlength="12"></td>

</tr>
</table>
<br>
<input type="checkbox" name="shipto" value="Ship to billing address" onclick="return check();">Ship to billing address<br>
</form>
<h1>Shipping Address</h1>
<form name="form2">

<table border=0>
<tr>
<th width="150" align="right" valign="bottom"></th>
</tr>
<tr>
<th width="150" align="right">Name:</th>
<td colspan="5">
<input name="Customer" type="text" size="27" maxlength="40"></td>
</tr>
<tr>
<th width="150" align="right">Address:</th>
<td colspan="5">
<input name="Address" type="text" size="45" maxlength="64"></td>
</tr>
<tr>
<th width="150" align="right">City:</th>
<td><input name="City" type="text" size="12" maxlength="12"></td>
<th align="right">State:</th>
<td>
<select name="State">
<option value="" selected></option>
<option value="AL">AL</option>
<option value="AK">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
<option value="DC">DC</option>
<option value="DE">DE</option>
<option value="FL">FL</option>
<option value="GA">GA</option>
<option value="HI">HI</option>
<option value="ID">ID</option>
<option value="IL">IL</option>
<option value="IN">IN</option>
<option value="IA">IO</option>
<option value="KS">KS</option>
<option value="KY">KY</option>
<option value="LA">LA</option>
<option value="MA">MA</option>
<option value="MD">MD</option>
<option value="ME">ME</option>
<option value="MI">MI</option>
<option value="MN">MN</option>
<option value="MO">MO</option>
<option value="MS">MS</option>
<option value="MT">MT</option>
<option value="NC">NC</option>
<option value="ND">ND</option>
<option value="NE">NE</option>
<option value="NH">NH</option>
<option value="NJ">NJ</option>
<option value="NM">NM</option>
<option value="NV">NV</option>
<option value="NY">NY</option>
<option value="OH">OH</option>
<option value="OK">OK</option>
<option value="OR">OR</option>
<option value="PA">PA</option>
<option value="RI">RI</option>
<option value="SC">SC</option>
<option value="SD">SD</option>
<option value="TN">TN</option>
<option value="TX">TX</option>
<option value="UT">UT</option>
<option value="VA">VA</option>
<option value="VT">VT</option>
<option value="WA">WA</option>
<option value="WI">WI</option>
<option value="WV">WV</option>
<option value="WY">WY</option>
</select>
</td>
<th align="right"><b>Zip:</b></th>
<td>
<input name="Zip" type="text" size="9" maxlength="10"></td>
</tr>
<tr>
<th width="150" align="right">Phone:</th>
<td>
<input name="Phone" type="text" size="12" maxlength="12"></td>

</tr>
</table>

</form>

</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@PandaQauthorDec 02.2004 — Thank you SOO much. I wish I could get this down better but it's just not clicking with me like I would like it too! Thank you for all your help. Can I borrow your brain till the end of the semester for the rest of my programs? ? Thanks a bunch again!!!
Copy linkTweet thisAlerts:
@Brandoe85Dec 02.2004 — You're welcome and good luck with the rest of them?
×

Success!

Help @PandaQ spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...