JavaScript - Multiple Email Subscription Form
Hey folks, I hope everyone is having a good day.
I'm in need of some code that will allow people to subscribe to multiple email lists. I would like for there to be a check box per choice and an input box where the email address would be entered. That way they can subscribe to one or the other, or both at the same time. I did a Google search and wasn't receiving what I needed. Any help would be much appreciated. Thanks!! gabe Similar TutorialsHi, I need to create a subscription form with a pop up window. I would like to re-do the following html code so that it works with a JavaScript pop-up: Code: <form style="border:1px solid #ccc;padding:3px;text-align:center;" method="post" rel="nofollow" target="popupwindow" action="http://feedburner.google.com/fb/a/mailverify" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=PinkPigeon', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"> <p>Enter your email address:</p><p><input type="text" style="width:140px" name="email"/><input type="hidden" value="PinkPigeon" name="uri"/><input type="hidden" name="loc" value="en_US"/><input type="submit" value="Subscribe" /></p><p>Pink Pigeon Feed</p></form> if anyone can help that would be great thanks Will Hello, could anyone help me with the javascript code? i have the HTML form code below and i want to create a javascript to work with it. Please see the code below: Code: <form method="post" name="login_form"> Name: <input type="text" name="login_username" value="" /><br> Password: <input type="password" name="secretkey" /><br> <input type="hidden" name="js_autodetect_results" value="0" /> <input type="hidden" name="just_logged_in" value="1" /> <INPUT CHECKED NAME="domain" TYPE="radio" VALUE="@camintel.com">@camintel.com<BR> <INPUT NAME="domain" TYPE="radio" VALUE="@camintel.com.kh">@camintel.com.kh<BR> <input type="submit" value="Login" /><br> </form> I have two domain "camintel.com" and "camintel.com.kh" with one email login form. could anyone write me a javascript that have the following option. 1. when user select camintel.com , it will login to http://users.camintel.com/squirrelmail/src/redirect.php 2. when user select camintel.com.kh, it will login to http://www.camintel.com.kh/webmail/src/redirect.php Please help me with this, i tried to code my self. But none is working. And Last Sorry for my bad english. Best Regards, Kenshin Hello, could anyone help me to write the javascript code? .. i have the code below: Code: <script> var urls = [ "http://users.camintel.com/squirrelmail/src/redirect.php", "http://www.camintel.com.kh/webmail/src/redirect.php" ]; </script> <form method="post" name="login_form" onsubmit="this.action=urls[this.domain[0].checked ? 0 : 1]; return true;"> Username: <input type="text" name="login_username" value="" /><br> Password: <input type="password" name="secretkey" /><br> <input type="hidden" name="js_autodetect_results" value="0" /> <input type="hidden" name="just_logged_in" value="1" /> <INPUT CHECKED NAME="domain" TYPE="radio">@camintel.com<BR> <INPUT NAME="domain" TYPE="radio">@camintel.com.kh<BR> <input type="submit" value="Login" /><br> </form> I want to add javascript to cut the string in Username. When the use type full domain address it will cut the string from "@camintel.com" and "@camintel.com.kh" . So if user type "test@camintel.com" in Username, the input will be "test". I tried to code it my self, but none is working. So please, could u help me to code this? Thanks alots. Best Regards, Kenshin I am having trouble with my Contact Us form. For the validation for email, in function validateEmail in my javascript portion where if I include: Code: else if (fld.value(".com")==-1 && entEmail.indexOf(".net")==-1 && entEmail.indexOf(".org")==-1 && entEmail.indexOf(".edu")==-1) { window.alert("Please recheck your email address. it must in name@domain.xxx format."); return false; } It skips the validation when I click the submit button and sends without validating the form. When I remove the code snippet above it validates fine but doesn't check for ".com", ."org", or ."net" which has to be included. I need to include a proper email address that includes "@" AND either one of these: ".com", ."org", or ."net" Anyone know of any ideas to solve this? Hey all, I'm trying to email this form to myself using jQuery.ajax script but for some reason I'm not getting the emails. Here is my html for where the jquery exists on: Code: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Form</title> <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/> <link rel="stylesheet" href="css/template.css" type="text/css"/> <script src="js/jquery-1.6.min.js" type="text/javascript"> </script> <script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"> </script> <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"> </script> <script src="js/formcalculations.js" type="text/javascript" charset="utf-8"> </script> <script> var result = new Array(); result[4400]= "<h3>Category One - $4,400/Year</h3><ul><li>Allergy & Immunology</li><li>Endocrinology</li><li>Pathology</li><li>Dermatology</li><li>Geriatrics</li><li>Physical Rehabilitation</li></ul>"; result[6900]= "<h3>Category Two - $6,900/Year</h3><ul><li>Family Practice</li><li>General Practice</li><li>Internal Medicine</li><li>Onconlogy</li><li>Oral Surgrey</li><li>Radiology</li><li>Gastroenterology</li><li>Infectious Disease</li><li>Nephrology</li><li>Ophthalmology</li><li>Pediatrics</li><li>Urology</li></ul>"; result[9000]= "<h3>Category Three - $9,000/Year</h3><ul><li>Anesthesiology</li><li>Cosmetic Surgrey</li><li>General Surgrey</li><li>Neurology</li><li>Otolaryngology</li><li>Plastic Surgery</li><li>Vascular Surgery</li><li>Cardiology</li><li>Emergency Medicine</li><li>Gynecology</li><li>Orthopedic Surgery</li><li>Pain Management</li><li>Pulmonary Surgery</li></ul>"; result[9900]= "<h3>Category Four - $9,900/Year</h3><ul><li>Neurological Surgery</li><li>Obstetrics</li></ul>"; function sendForm() { var user = jQuery("#username").val(); var address = jQuery("#address").val(); var phone = jQuery("#phone").val(); var practice= jQuery("#practice").val(); var society= jQuery("#society").val(); var phone = jQuery("#phone").val(); var bare = jQuery("#baredefense"); var insured = jQuery("#insureddefense"); var interested = ""; if( bare.attr("checked") == "checked" && insured.attr("checked") == "checked" ) { interested = "Bare Defense And Insured Defense"; }else if(bare.attr("checked") == "checked") { interested = "Bare Defense"; }else if(insured .attr("checked") == "checked") { interested = "Insured Defense"; }else { interested = "";} var titleSociety = jQuery('#society option:selected').text(); var fdata = "username="+name+"&address="+address+"&phone="+phone+"&practice="+practice+"&society="+titleSociety+"&interested="+interested; var content = "Practice Field: "+practice+"<br />Medical Society: "+titleSociety+"<br />Interested in: "+interested; var res = calculateTotal(); jQuery("#CalculationResult").html(content+"<br /><br />"+res); jQuery.ajax({ url: "js/ajax.php", data: fdata, method: "GET", success: function(r) { // setTimeout("clearForm()", 2000); } }); return false; } jQuery(document).ready(function(){ // binds form submission and fields to the validation engine //jQuery("#quoteform").validationEngine(); jQuery("#quoteform").validationEngine('attach', { onValidationComplete: function(form, status){ if(status == true) { sendForm(); } return false; } }); }); function clearForm(){ //jQuery("#quoteform").hide(); document.getElementById('quoteform').reset(); jQuery("#quoteform").validationEngine('hideAll'); return false; } </script> </head> <body> <form id="quoteform" class="formular" method="post"> <fieldset> <legend> How Much Will My Pre-Paid Legal Defense Cost? </legend> <div class="FormContainer"> <label> <span>Name *: </span> <input value="" class="validate[required] text-input" type="text" name="username" id="username" /> </label> <label> <span>Address *: </span> <input value="" class="validate[required] text-input" type="text" name="address" id="address" /> </label> <label> <span>Phone number *: </span> <input value="" class="validate[required,custom[phone]] text-input" type="text" name="phone" id="phone" /> </label> <label> <span>Choose Your Practice Field *:</span> <select name="practice" id="practice" class="validate[required]"> <option value="">--Select Field--</option> <option value="Allergy and Immunology">Allergy and Immunology</option> <option value="Endocrinology">Endocrinology</option> <option value="Pathology">Pathology</option> <option value="Dermatology">Dermatology</option> <option value="Geriatrics">Geriatrics</option> <option value="Physical Rehabilitation">Physical Rehabilitation</option> <option value="Family Practice">Family Practice</option> <option value="General Practice">General Practice</option> <option value="Internal Medicine">Internal Medicine</option> <option value="Oncology">Oncology</option> <option value="Oral Surgery">Oral Surgery</option> <option value="Radiology">Radiology</option> <option value="Gastroenterology">Gastroenterology</option> <option value="Infectious Disease">Infectious Disease</option> <option value="Nephrology">Nephrology</option> <option value="Ophthalmology">Ophthalmology</option> <option value="Pediatrics">Pediatrics</option> <option value="Urology">Urology</option> <option value="Anesthesiology">Anesthesiology</option> <option value="Cosmetic Surgery">Cosmetic Surgery</option> <option value="General Surgery">General Surgery</option> <option value="Neurology">Neurology</option> <option value="Otolaryngology">Otolaryngology</option> <option value="Plastic Surgery">Plastic Surgery</option> <option value="Vascular Surgery">Vascular Surgery</option> <option value="Cardiology">Cardiology</option> <option value="Emergency Medicine">Emergency Medicine</option> <option value="Gynecology">Gynecology</option> <option value="Orthopedic Surgery">Orthopedic Surgery</option> <option value="90Pain Management00">Pain Management</option> <option value="Pulmonary Surgery">Pulmonary Surgery</option> <option value="Neurological Surgery">Neurological Surgery</option> <option value="Obstetrics">Obstetrics</option> </option> </select> </label> <label> <span>Are You Affiliated With Any of the Following Medical Societies *:</span> <select name="society" id="society" class="validate[required]"> <option value="">--Select Society--</option> <option value="0">No, I am not</option> <option value="BCMA">Broward County Medical Association</option> <option value="DCMA">Dade County Medical Association</option> <option value="FOGS">Florida Obstetrics & Gynecology Society</option> <option value="FNS">Florida Neurological Society</option><option value="PBCMS">Palm Beach County Medical Society</option><option value="FSPS">Florida Society of Plastic Surgeons</option> </select> </label> <label> <span>What Type of Defense Are You Interested In? *:</span><br /> Bare Defense <input type="checkbox" value="5" id="baredefense" name="baredefense" class="d"><br />Insured Defense <input type="checkbox" value="5" id="insureddefense" name="insureddefense" class=""> </label> <input class="submit" onclick="clearForm();" type="reset" value="Reset!"/> <input class="submit" type="submit" value="Submit!"/><hr/> </div> <div class="CalculationContainer"> <div id="CalculationResult"> Please select.... </div> </div> </fieldset> <!-- <fieldset> <legend> Equals </legend> <label> <span>Password : </span> <input value="karnius" class="validate[required] text-input" type="password" name="password" id="password" /> </label> <label> <span>Confirm password : </span> <input value="kaniusBAD" class="validate[required,equals[password]] text-input" type="password" name="password2" id="password2" /> </label> </fieldset> --> </form> </body> </html> I have been modifying this form: http://www.kartaway.com.au/form.html to be part of an iPhone optimized site for the same client. The modified form works, however it no longer stops emails being sent that do not have the required fields filled in. The modified form is he http://marketingandbranding.com.au/itest/icontact.html The original is built using a table which I have removed and replaced with divs. Didn't think I'd left anything out which would matter but I guess I must have. Please help, i don't really know any JavaScript except what I copy and paste. I am a javascript begginer and would like to know what is this bit of code saying? (email.indexOf("@",atPos+1) > -1) Thank you! Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Email checker</title> <script type="text/javascript"> function validEmail(email) { invalidChars = " /:,;" if (email == "") { return false; } for (i=0; i<invalidChars.length; i++) { badChar = invalidChars.charAt(i) if (email.indexOf(badChar,0) > -1) { return false; } } atPos = email.indexOf("@",1) if (atPos == -1) { return false; } if (email.indexOf("@",atPos+1) > -1) { return false } periodPos = email.indexOf(".",atPos) if (periodPos == -1) { return false; } return true; } function submitIt(emailForm) { if (!validEmail(emailForm.emailAddr.value)) { alert("Invalid email address"); emailForm.emailAddr.focus(); emailForm.emailAddr.select(); return false } alert("email is correct!"); return true; } </script> </head> <body> <h2>Email checker</h2> <form onsubmit="return submitIt(this)" action="#"> Email Address: <input name="emailAddr" type="text" size="30" /> <p><input type="submit" value="Submit" /> <input type="reset" /></p> </form> </body> </html> alright so i am trying to validate this form and if you do not fill out the Day of the week then it does not submit the form to email.... Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Guest List Signup</title> <style type="text/css"> <!-- body,td,th { color: #FFF; } body { background-color: #000; } --> </style></head> <script type='text/javascript'> function madeSelection(elem, helperMsg){ if(elem.value == "Select"){ alert(helperMsg); elem.focus(); return false; }else{ return true; } } </script> <body bgcolor="#000000" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF"> <form name="halo-gl" form method="POST" action="contactgl.php"> <p>If you want to have your name on the HALO guest list please fill out the form below before 9pm and you and your guests will be on the list at the door. <p>This will get you free entry* until 11:30pm (this means at 11:31pm the list is over) also on select events there will not be a list and we might not have it posted on the website. <p>Guest list does not guarantee entry. It is to the discression of Halo on wether someone is permitted or not. <p> <p>Your Name:<br> <input type="text" name="MyName"> (First and Last) <p>How Many People I Will Have:<br> <select name="HowManyPeopleIWillHave"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <p>What day to be on the list:<br> <select id='selection'> <option value="Select">Please Select</option> <option value="Wednesday">Wednesday</option> <option value="Thursday">Thursday</option> <option value="Friday">Friday</option> <option value="Saturday">Saturday</option> </select> <p><input type="submit" name="submit" value='Submit' onclick="madeSelection(document.getElementById('selection'), 'Please Choose Something')" > </form> <p> </body> </html> you can see this currently in action at http://www.haloclt.com/guestlist.html any help would be appreciated thank you Hi, I have a simple bit of HTML / Javascript to validate email addresses entered into a field, split by a comma. Code: <html> <body> <form name="myForm" onsubmit="return chkEmail()" method="post"> e: <input type="text" name="fname"> <input type="submit" value="Submit"> </form> </body> </html> Code: function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } function chkEmail(){ var myString = document.forms["myForm"]["fname"].value; var mySplitResult = myString.split(","); for(i = 0; i < mySplitResult.length; i++){ emailCheck = validateEmail(mySplitResult[i]); alert(mySplitResult[i] + " - " + emailCheck); if (emailCheck = 'false') { alert(emailCheck); } } } If I enter e.g. "you@me.com,this@that.com" into the form, the alert debugs show: First: you@me.com - true Second: false Third: this@that.com - true Fourth: false The first debug seems to show that the condition is true, but then the if statement to check for a "false" value is firing, showing the value of "emailCheck" = "false", even though on the preceding alert, the value = "true". I'm not sure what's going wrong. Apologies for any silly mistakes. I also put my code he http://jsfiddle.net/XYyZa/ Thanks Hey everyone. I hope you can help me getting through this problem, because I have no idea of what else to try. I'm a web designer and sometimes modify Javascript, but my main focus is HTML and CSS, meaning I have no idea how to code in Javascript or how to write something from scratch in PHP. So I designed a form that works pretty well, and integrated a PHP and Javascript script to make it work. This is the form: Code: <form name="form" id="form" method="post" action="contact.php"> <p>Hello,</p> <p>My name is <input type="text" name="name">, from <input type="text" name="location">, and I'd like to get in touch with you for the following purpose:</p> <p><textarea name="message" rows="10" ></textarea></p> <p>By the way, my email address is <input type="text" name="email" id="email" placeholder="john@doe.com">, and I can prove I'm not a robot because I know the sky is <input type="text" name="code" placeholder="Red, green or blue?">.</p> <p title="Send this message."><input type="submit" id="submit" value="Take care."></p> </form> And this is the script, in an external file called contact.php: Code: <?php $name = check_input($_REQUEST['name'], "Please enter your name.") ; $location = check_input($_REQUEST['location']) ; $message = check_input($_REQUEST['message'], "Please write a message.") ; $email = check_input($_REQUEST['email'], "Please enter a valid email address.") ; if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) {die("E-mail address not valid");} if (strtolower($_POST['code']) != 'blue') {die('You are definitely a robot.');} $mail_status = mail( "my@email.com", "Hey!", "Hello,\n\n$message\n\nRegards,\n\n$name\n$location", "From: $email $name" ); function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <body> <b>Please correct the following error:</b><br /> <?php echo $myError; ?> </body> </html> <?php exit(); } if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. I will try to respond as soon as I can.'); window.location = '/about'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('There was an error. Please try again in a few minutes, or send the message directly to aalejandro@bitsland.com.'); window.location = '/about'; </script> <?php } ?> So what it does is this: if everything's OK, it sends an email with "Hey!" as the subject, "[name]" as the sender, "Hello, [message]. Regards, [name], [location]" as the body, and a popup saying the message was delivered appears. If something fails, it outputs the error in a new address, so the user will have to go back to the form and correct the error. What I actually want to happen is this: if everything's OK, a <p> which was hidden beneath the form appears saying the message was delivered, or, alternatively, make the submit button gray out and confirm the message was delivered. I found a script to make this happen, but with "Please wait...", so the user can't resubmit the form. If there's an error, I'd like another <p> which was hidden to appear with the specific error, so there'd be many <p>'s hidden with different IDs. If possible, I'd also like to change the CSS style of the input field, specifically changing the border color to red, so it'd be a change in class for the particular field. -- So in essence, I want the errors and the success messages to output in the same page as the form (without refresh), and a change of class in the input fields that have an error. It'd be great if the submit button could be disabled until all fields are filled correctly, but I don't know if this is possible. Thanks in advance, and please let me know if it'll be possible. :) Hey there guys, I am building a site of which I would like the contact information and form to pop up from the button on the menu/header frame into the main frame as a lightbox ...no matter which page is loaded in the main frame. I was trying to experiment with the archived "jQuery Contact form for your website" tutorial from web devlopment blog . com. (I didnt want to post a link to it as I dont want to possibly flag the moderators) Any Ideas? Go to http://whitetailfantasies.com to see the layout and what I am going for. Thanks Hi! I would like to show you guys the JavaScript that i using for my contact form /*----- Code goes here by clicking the link -----*/ http://web.ezenne.com/js/completeValid.js The above code was copied from a Youtube tutorial about JavaScript. I would like to ask, what additional code should be added in the existing code in order to validate the numbers only and an email format before the form to be submitted? Thanks! Regards, Ezenne Hello, I'm in need of some help. I have a form that I want to clone and add up to 5 duplicates with slight changes. The changes a Add a second question and another set of related radio buttons for only the duplicates. Change the title in the Header to increment by 1 ex. Header 1, Header 2... I also would like to make the form elements "id" and "names" unique. Also, continue to use the add and remove button at the bottom. I hope this is doable. Any help will be appreciated. I have included my existing code. NOTE: for a visual, I mocked up the the original form and 1 copy of the fields in the html, not to be used. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script type="text/javascript" src="http://tablesorter.com/jquery-latest.js"></script> </head> <body> <script type="text/javascript"> $(document).ready(function() { $('#btnAdd').click(function() { var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have var newNum = new Number(num + 1); // the numeric ID of the new input field being added var newElem = $('#section' + num).clone().attr('id', 'section' + newNum); newElem.children(':first').attr('id', 'first' + newNum).attr('name', 'first' + newNum).val(''); newElem.children(':first').attr('id', 'last' + newNum).attr('name', 'last' + newNum).val(''); newElem.children(':first').attr('id', 'phone' + newNum).attr('name', 'phone' + newNum).val(''); newElem.children(':first').attr('id', 'email' + newNum).attr('name', 'email' + newNum).val(''); newElem.children(':first').attr('id', 'yes' + newNum).attr('name', 'yes' + newNum).val(''); newElem.children(':first').attr('id', 'no' + newNum).attr('name', 'no' + newNum).val(''); $('#section' + num).after(newElem); $('#btnDel').attr('disabled',''); if (newNum == 5) $('#btnAdd').attr('disabled','disabled'); }); $('#btnDel').click(function() { var num = $('.clonedInput').length; // how many "duplicatable" input fields we currently have $('#section' + num).remove(); // remove the last element $('#btnAdd').attr('disabled',''); // enable the "add" button // if only one element remains, disable the "remove" button if (num-1 == 1) $('#btnDel').attr('disabled','disabled'); }); $('#btnDel').attr('disabled','disabled'); }); </script> <form id="myForm"> <div id="section1" style="margin-bottom:4px; border-bottom:1px solid #000; width: 400px;" class="clonedInput"> <br> <br> <div style=" font-weight:bold; border: 1px solid #000; padding:4px;background:#CCC; font-size:18px; margin-bottom:5px;">Header</div> First: <input type="text" name="first1" id="first1" /> <br> <br> Last: <input type="text" name="last1" id="last1" /> <br> <br> <br /> <div style=" font-weight:bold;padding:4px;">Header 2</div> <div>Show this question and radios on load of page.</div> <div> <input type="radio" id="yes1" class="eRad" name="yes1" value="" /> <label class="" for="yes">Yes</label> <input type="radio" id="no1" class="eRad" name="no1" value="" /> <label class="" for="no">No</label> </div> Phone: <input type="text" name="phone1" id="phone1" /> <br> <br> Email: <input type="text" name="email1" id="email1" /> </div> <div id="section1" style="margin-bottom:4px; border-bottom:1px solid #000; width: 400px;" class="clonedInput"> <br> <br> <div style=" font-weight:bold; border: 1px solid #000; padding:4px;background:#CCC; font-size:18px; margin-bottom:5px;">Header 2 (increment this number)</div> <div>Show this new question and radios on all copies</div> <div> <input type="radio" id="yes_a2" class="eRad" name="yes_a2" value="" /> <label class="" for="yes">Yes</label> <input type="radio" id="no_a2" class="eRad" name="no_a2" value="" /> <label class="" for="no">No</label> </div> First: <input type="text" name="first2" id="first2" /> <br> <br> Last: <input type="text" name="last2" id="last2" /> <br> <br> <br /> <div style=" font-weight:bold;padding:4px;">Sub Header 2 (increment this number)</div> <div>Show this question and radios on load of page.</div> <div> <input type="radio" id="yes_a2" class="eRad" name="yes_a2" value="" /> <label class="" for="yes">Yes</label> <input type="radio" id="no_a2" class="eRad" name="no_a2" value="" /> <label class="" for="no">No</label> </div> Phone: <input type="text" name="phone2" id="phone2" /> <br> <br> Email: <input type="text" name="email2" id="email2" /> </div> <div style="margin-top:10px;"> <input type="button" id="btnAdd" value="add another name" /> <input type="button" id="btnDel" value="remove name" /> </div> </form> </body> </html> -Cheers Hey everyone, I'm having a problem with a project i'm working on. We have a webpage setup to alpha page individual people with pagers at work. It is a simple form that submits to a php file on the pager server. I am working on creating a script that submits a alpha-page to everyone at once. There are about 120 different ppl in the company, I want the script to submit the form once for each persons pager. I'm new to javascript but have alittle programming understanding. This is what i have so far: Code: <html> <head> <title>Send a Page</title> </head> <body> <center> <form action="http://sendpage/pager/PageSend.php" method="POST"> <input type="hidden" name="ContactPagerNumberId[]" value="120"> <input type="hidden" name="PagemessageId" value="What are you doing?"> <input type="hidden" name="ScheduledDeliverydateId" value="2011-08-22"> <input type="hidden" name="ScheduledDeliveryTimeId" value="19:30:00"> <input type="hidden" name=ScheduledDeliveryAmPmId" value="selected"> <button style="width:140px; height:30px" type="submit" name="SEND">Submit</button> </form> </body> </html> The ContactPagerNumberId[] is the arbitrary value set to individual ppl's pagers. I'm not sure where to place the javascript code at. It doesn't seem as hard as I'm making it out to be. Any suggestions? hello guys! I need help setting up a form, I want to do some pretty neat things: It will say: What countries do you want to visit? [FIELD] Part 1: I want that when a user starts typing into the field, it will suggest under things that match what you have typed so far, sort of like facebook search does. So I would need a list of recognized country names. Now for example imagine I was using this, and I typed in M, it would list under a max of 5 valid entries begining with M, if I typed in Me, it would list the ones begining with Me, if I typed in Mex, it would show Mexico. Now the user would have to click this drop down suggestion to choose it. Part2: I want once a user clicks on a suggestion, it will "pop under" the input box or somewhere, with a "x" beside it to remove it. The user can now type in another country, and when it is clicked it too appears as a sort of "icon" under the input box or somewhere, with an "x" beside it. Clicking the x removes the country from the current list of countries. Once he is done, he goes on to other fields and the selected countries remain visible. Once a user submits the form, I want to get only the countries that were visible to him. **An alternative idea, if this one is too complicated, would be to have a drop list with all countries in it, and once a person clicks one, it will remain and a "+" sign will appear under it. When pressed, another dropdown menu will appear so the person can choose another country from the second drop down, etc. OFC all selected countries can have an X to remove them. Idk how to do this either.. I need help guys I have no clue how to do something like this, where do you recommend I start? Any ideas? I tried searching but I'm not sure what to call this so I couldn't find anything in the search. Thanks for your help so much!! hi there, I'm looking for a method to use several hyperlinks to submit a form and then return the page within the link for example Code: <a href="thispage.php?mode=1" Onclick="javascript:form.submit();"> <a href="thispage.php?mode=2" Onclick="javascript:form.submit();"> the reason for this is so that no matter which link a user navigates to the form will be submitted and no data lost. however the above code obviously loses the POST info as the form action will be different from the a tag. Therefore I think maybe a way of creating a variable that changes the form action to match the a link selected (as the form(s) are submitted to the same php page. hope someone can think clearer than me! cheers I have many radio buttons associated with questions on a page with Yes/No options. Depending on if Yes or No is selected (varies with question), I need to prevent the user from going off of the page and somehow "mark" the questions that are answered "incorrectly/not preferred". I could probably put validation on each individual radio button and display a message when going off the page, but I'm looking to make this more dynamic. One idea I had was to put a function on each radio button's onChange event and build an array using .push() to construct the array with all the radio button IDs that are answered incorrectly. I ran into problems when deleting from the array when the radio button was changed back to a correct response though. What may be best is to somehow indicate which radio buttons need looked at when leaving the page and then run a function or case statement over all the radio buttons to build an object? I'm not sure what approach to take. Any thoughts are appreciated. Thanks. I am very new to javascript and cannot find any info anywhere regarding the following problem: On my website I have around 100 pages containing an action form. Occasionally it is necessary to cancel the action throughout the 100 pages which is very time-consuming. Then the action has to be reinstated once again for all the 100+ pages. I thought the solution would be to use javascript to change the action from a .js file which would mean only one page, the .js file, would require alteration: The action that appears on all 100+ pages several times that I am trying to change or stop happening by overwriting the "form action": <form action="http://www.changenamecart.com/" method="post"> <input type="hidden" name="userid" value="1234567"> <input type="hidden" name="return" value="http://www.thehomepage.co.uk/index.htm"> <input type="image" src="http://www.changenamecart.com/images/pic.gif"> </form> My efforts to date a The change .js file: function change() { var myChange = form action; if(myChange == form action){ document.write("form xction"); } } The html file in the header: <script src="change.js" type="text/javascript"></script> I am afraid that my knowledge of programming is very small and I would welcome any help to solve this problem. I have a document that contains four forms. I want to run a function only in the form the user is currently in. I keep getting the "document.my_form_name is undefined" error. I've tried all sorts of ways of doing this but can't find a solution. Here's a snippet of the HTML: Code: <form id="my_form_1" name="my_form_1" action="some action" method="POST"> // in here I call the function onchange_display_sel_droplist and // pass through the name of the form </form> <form id="my_form_2" name="my_form_2" action="some action" method="POST"> bla bla </form> Here's the part of the function in question: Code: function onchange_display_sel_droplist(my_value, my_object, my_text_obj, my_form_name) { // create array with all the divs found var arr = new Array(); arr = document.my_form_name.getElementsByTagName( "div" ); // loop through array for(var i=0; i < arr.length; i++) { var tagId = document.my_form_name.getElementsByTagName( "div" ).item(i).id; // find all the divs with ID "my_selected_div__" if ( tagId.indexOf("add_selected_div__") > -1 ) { // hide all document.my_form_name.getElementById(tagId).style.display = "none"; } } // display selected object (droplist) document.my_form_name.getElementById(my_object).style.display = ""; } |