JavaScript - 2 Forms 1 Submit Please Help Nothing Works
hello.
ok my problem is that i have to submit 2 or more lines of text to my shopping cart. each line of text has its own form and you cant put more then one line in one form. please help me make this work <NOSCRIPT>This shopping-cart needs JavaScript. Please enable JavaScript in your browser's preferences.</NOSCRIPT> <script> if(typeof navigator.cookieEnabled=="boolean" && !navigator.cookieEnabled) alert("You need to enable Cookies in your browser, before this shopping-cart will work for you!"); </script> <!-- <script src=noper-language-pdt.utf8.js></script> --> <script src=http://www.mlpdecals.com/cgi/nopercart.js></script> <!-- nopERcart Shopping-Cart, from http://ereimer.net/nopercart.htm --> <FORM action="shoppingcart.htm" method=GET onSubmit="return AddToCart(this)"> <font class=bigtext><b>Special Instructions:</b></font><br> <input type=text size=32 maxlength=200 name=USERTEXT> <input type=hidden _PRICE="0.00" _QUANTITY="1" _NAME="special-instructions" _ID="nSPCI"> <input type=submit value="Add Instructions to Cart" class=bigbutton> </FORM> Similar TutorialsI have a userscript that helps me move things around on a vB based forum that I moderate. I am using the following to quickly select and submit my selection, however, when it hits the document.vbform.submit(); part of the code the pages just sits there. It does work if the forum ID's I have in place don't line up with any of the forum ID's on the forums but it just will ooad the page and say no such forum exists. So I know submit(); can work..... Code: // INJECT FUNCTION TO PAGE FOR LATER USE window.InjectFunction = function(reg) { if (reg == "na") { var theScr = "" + "function des(id) {" + "\nvar destination = document.getElementsByName('destforumid')[0];" + "\nvar radio = document.getElementsByName('redirect');" + "\nif (id == '39') {" + "\nradio[0].checked = true;" + "\n}" + "\nelse {" + "\nradio[2].checked = true;" + "\n}" + "\nfor ( var i = 0; i < destination.options.length; i++ ) {" + "\nif ( destination.options[i].value == id ) {" + "\ndestination.options[i].selected = true;" + "\nreturn;" + "\n}" + "\n}" + "\ndocument.vbform.submit();" + "\n}" } var scrTag = document.createElement("script") var scrHead = document.getElementsByTagName("head")[0]; scrTag.setAttribute('type', 'text/javascript'); scrTag.appendChild(document.createTextNode(theScr)); scrHead.appendChild(scrTag); } // ADD MENU THAT WILL PASS FORUM IDs AND CALL INJECTED FORUMS window.NewMenu = function(reg) { var divTag = document.createElement("div"); divTag.id = "div1"; divTag.setAttribute("align","left"); divTag.style.margin = "0px auto"; divTag.style.backgroundColor = "#f5edc3"; divTag.style.position = "fixed"; divTag.style.bottom = "0px"; divTag.style.left = "50%"; divTag.style.width = "196px"; divTag.style.marginLeft = "-98px"; divTag.style.height = "auto"; divTag.className ="dynamicDiv"; divTag.zIndex = "1000"; document.body.appendChild(divTag); if (reg == "na") { var dBody = '<div class="newmenu" onClick="des(\'2\');">SELECTION 2 </div>' + '\n<div class="newmenu2" onClick="des(\'43\');">SELECTION 2 </div>' + '\n<div class="newmenu" onClick="des(\'41\');">SELECTION 3 </div>' + '\n<div class="newmenu2" onClick="des(\'15\');">SELECTION 4 </div>' + '\n<div class="newmenu" onClick="des(\'4\');">SELECTION 5 </div>' + '\n<div class="newmenu2" onClick="des(\'3\');">SELECTION 6 </div>' + '\n<div class="newmenu" onClick="des(\'19\');">SELECTION 7 </div>' + '\n<div class="newmenu2" onClick="des(\'39\');">TRASH </div>' ; } divTag.innerHTML = dBody; } var location = window.location.toString(); var region = location.substring((location.indexOf("//") + 2), location.indexOf(".")); var view = location.substring((location.indexOf("board/") + 6), location.indexOf(".php")); if (view == "forumdisplay") { HideMoveClose(); ColorThreads(); } else if (view == "postings") { var destination = document.getElementsByName('destforumid')[0]; if ( destination != null) { ChangeRedirect(); InjectFunction(region); NewMenu(region); ApplyCSS(); window.scrollTo(0,document.body.scrollHeight); } } else if (view == "search") { ColorThreads(); } else { //alert(); } Please note I have edited out a large portion of this code to make the search for the problem a little easier and the code that remains is relevant to the issue. As you can see there are other functions and blah blah but those all work correctly. On the if statements I removed the else if's and else since they are basically just the same thing as the if portion just with a different region code. I have wrapped this whole deal in try {} catch() {} but no errors get thrown. Please any thoughts? I have a web page with two forms, when I click the button on one of the forms, the onclick event goes to a javascript that emails the first form and then the second form. This is correct, this is the way I want this to work. It's simple, it's easy, it works! However, it only works in FireFox and Internet Explorer, it will not work in Google Chrome browser. I've spent many hours trying lots of various ways to implement this so I'm not interested in speculating about possible solutions that might work, I've already tried too many of those. Also, it needs to work this way, not combining the forms, etc. Does anyone have any tried and tested solutions that work with Chrome? Thanks, in advance, for your expert advice. I know I can always rely on EE when all else fails. I know somebody here can solve this problem. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <title></title> </head> <body> <form id="NameForm" method="post" action="mailto:yourFirstemail@email.com"> Name: <input type="text" size="10" name="name"> <br /> <input onclick=functionCaller() type="button" value="Submit Two Forms"> </form> <form id="AddressForm" name="DComments" method="post" action="mailto:yourSecondemail@email.com"> Address: <input type="text" size="10" name="address"> <br /> </form> <script type="text/javascript"> <!-- function functionCaller() { document.getElementById('NameForm').submit(); document.getElementById('AddressForm').submit(); } --> </script> </body> </html> What needs to be done to have the below input (red) passed to the forms action (blue) when the submit button is pressed. Obviously this should be the user input value and not the default 0.00 one. Ty. echo ' <center> <form method="post" action="https://www.paymate.com/PayMate/ExpressPayment?mid=MoreBloodWine&popup=false&ref=EoJ Market Place Donation¤cy=USD&amt= 1.23 &amt_editable=N&return=http://www.eojmarket.com"> Donation Amount: $<input style="vertical-align: middle; color: #FFFFFF; background-color: transparent; border: 1px solid; border-color: #9E853D; padding: 0px 0px 0px 1px; font-size: 10px; width: 50px;" name="amount" type="text" maxlength="6" value=" 0.00 "> <br /> <input type="image" style="padding-top: 10px; padding-bottom: 10px; border: none;" src="http://www.eojmarket.com/NonForumStuff/images/paymate-donate-button.png" value="Submit" alt="Pay with Paymate Express !"/> </form> </center> '; I'm using the autofill forms plugin for firefox which can be found he https://addons.mozilla.org/en-US/firefox/addon/4775 I use it to automatically fill various web forms, duh. But I would like certain values to be chosend randomly from a list I create. I contacted the developer and he said the add on probably does not need a new feature because there is a 'dynamic tags' function to fill certain forms with dynamic values (e.g. the current time or date). He has given over the project to another developer and told me I probably would find a solution in a good javascript programming forum. So here I am! Can anyone help me with this? Basically, I just need a javascript code which chooses on item from an array randomly, I guess? I'm not a programmer myself, so any help would be greatly (!) appreciated. Thanks a lot in advance for any further guidance! Note: Here are sample dynamic tags from the plugin: <datetime> new Date().toLocaleString() <useragent> navigator.userAgent <langcode> navigator.language <resolution> screen.width+'x'+screen.height <clipboard> this.getClipboardText() Hi, I have a form that when you click submit gives a warning box asking if to continue code below Now when I type in the text field and press enter it doesn't submit nor does it pop up the warning box, how would I do this Code for submit button Code: <script LANGUAGE="JavaScript"> <!-- function submitMyForm() { var agree=confirm("ARE YOU SURE ?"); if (agree) return true ; else return false ; } // --> </script> Code: <form action="admin-delete.php" method="post" name="cp_delete" id="cp_delete"> <input type="text" name="cp_delete_bg" id="cp_delete_bg"> <input type="submit" name="submit" value="submit" onclick="return submitMyForm()"/> </form> Hi all Is using the real form submit button a problem in any way? Can it actaully send a form when a person uses 'enter' in a text field. When I use this submit, it triggers my validation which is great. Code: <input type="submit" value="OnSubmit validate" /> However this way doesn't seem to trigger my validation although It may solve the above form send problem (if that realy exists). How do I get it to act the same as real submit so it will trigger validation like onsubmit above? Code: <input type="button" value="Send Feedback" onclick="this.form.submit()" /> LT does any of that make sense? all ideas helpful and appreciated I've got the following 2 fields in my form: <input type="file" name="filename" id="filename" value="filename"> <input type="submit" name="submit" value="Upload Image" /> Now I want to hide both of them as soon as the submit button is pressed. Problem is that I'm a javascript noob and I can't find it with google :S Can someone help me? I have created some online software which uses form data to submit to another page. The problem is that I have other submit buttons in the same form which submit to different pages (depending on which button is pressed). The first submit button works fine but all the others only work once. Code: <input class="cssbutton" type='submit' value='Button1' onclick="wbform.action='page1.php'; target='mainFrame'; return true;"> <input class="cssbutton" type='submit' value='Button2' onclick="wbform.action='page2.php'; target='_blank'; return true;"> <input class="cssbutton" type='submit' value='Button3' onclick="wbform.action='page3.php'; target='topFrame'; return true;"> <input class="cssbutton" type='submit' value='Button4' onclick="wbform.action='page4.php'; target='topFrame'; return true;"> <input class="cssbutton" type='submit' value='Button5' onclick="wbform.action='page5.php'; target='_blank'; return true;"> <input class="cssbutton" type='submit' value='Button6' onclick="wbform.action='page6.php'; target='_blank'; return true;"> Any ideas my friends? Hi all, I'm designing something to addon to an existing product. I'm struggling with some javascript problems. I want to submit a hidden field when you click on an image button, rather than it being an actual submit button. It's going to submit the value "1" to a PHP page, but I don't want it to actually have to GO to the PHP page, just submit it within the webpage. Is this possible? Thanks I am trying to auto submit a login form remotely using .submit() . It's submitting, but for some reason if I use submit() the login isn't processing. However, if I turn off the auto submit and use an actual submit button it logs in just fine. Now, in the form tag there is a call onsubmit for some validation, does .submit() trigger that form onsubmit="" function? Is there something that happens differently when a user clicks a button verses the .submit(). Thanks! Paul Forgive me if this isn't in the right spot. I'm new at php and java so bear with me. I have small form I found and modified. This works as I wanted it to. Code: <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function solveALK(form) { var alkalinity = eval(form.alkalinity.value); var alkneeds = eval(form.alkneeds.value); var change = (alkneeds) - (alkalinity); var add1 = (change) / (10) * (0.075) * (1.5) * (16); var add2 = (add1) / (16); form.alkchange.value = change; form.addoz.value = add1; form.addlbs.value = add2; } // End --> </script> </HEAD> <!-- STEP TWO: Copy this code into the BODY of your HTML document --> <BODY> <center> <table> <tr><td> </td> </tr> </table> <form method=post name=alkform> <table border=4> <tr> <td align=center> Alkalinity </td> <td align=center> <input type=text name=alkalinity size=3> </td> <td align=center> Needs to be: </td> <td align=center> <input type=text name=alkneeds size=3> </td> </tr> <tr> <td align=center> Change required: </td> <td colspan=3 align=center> <input type=text name=alkchange size=3> </td> </tr> <tr> <td align=center> Add this amount </td> <td colspan=3 align=center> <input type=text name=addoz size=3>oz </td> </tr> <tr> <td align=center> Add this amount </td> <td colspan=3 align=center> <input type=text name=addlbs size=3>lbs </td> </tr> <tr> <td colspan=4 align=center> <input type=button name=alk value="Calculate" onClick="javascript:solveALK(this.form)"> </td> </tr> </table> </form> </center> However when I put this into my php file, When I add my 2 figures to the input boxes. and click the calculate button, I get a NaN. I'm thinking it might be because I have 2 forms on my php page. One area of the page will update the database while this one would just calculate some figures. Here's the php page that doesn't seem to work. Code: <html> <head> <link rel="stylesheet" type="text/css" href="../style1.css" /> <title>Pool Log Report</title> <SCRIPT LANGUAGE="JavaScript"> <!-- Chemical calulations --> <!-- Begin function solveALK(form) { var alkalinity = eval(form.alkalinity.value); var alkneeds = eval(form.alkneeds.value); var change = (alkneeds) - (alkalinity); var add1 = (change) / (10) * (0.075) * (1.5) * (16); var add2 = (add1) / (16); form.alkchange.value = change; form.addoz.value = add1; form.addlbs.value = add2; } // End --> </script> </head> <body class="body"> <center> <table class="main1"> <?php include("update_header.php"); ?> <form action="updated.php" method="post" name="FormName"> <tr> <td class="main2"><input id="Dayid" name="Dayid" type="text" size="1" value="<?php echo $Dayid ?>" maxlength="2" readonly></td> <td class="main3"> </td> <td class="main3"><input id="patron_loading_max" name="patron_loading_max" type="text" size="1" value="<?php echo $patron_loading_max ?>" maxlength="2"></td> <td class="main3"><input id="patron_loading_24hr" name="patron_loading_24hr" type="text" size="1" value="<?php echo $patron_loading_24hr ?>" maxlength="2"></td> <td class="main3"><input id="water_clearity__clear" name="water_clearity__clear" type="checkbox" <?php if ($water_clearity__clear == "X") { echo "checked";} ?> value="X"></td> <td class="main3"><input id="water_clearity__turbid" name="water_clearity__turbid" type="checkbox" <?php if ($water_clearity__turbid == "X") { echo "checked";} ?> value="X"></td> <td class="main3"><input id="water_temp" name="water_temp" type="text" size="1" value="<?php echo $water_temp ?>" maxlength="3"></td> <td class="main3"><input id="psi" name="psi" type="text" size="1" value="<?php echo $psi ?>" maxlength="3"></td> <td class="main3"><input id="gpm" name="gpm" type="text" size="1" value="<?php echo $gpm ?>" maxlength="3"></td> <td class="main3"><input id="drain_back" name="drain_back" type="text" size="1" value="<?php echo $drain_back ?>" maxlength="5"></td> <td class="main3"><input id="chlorine_am1" name="chlorine_am1" type="text" size="1" value="<?php echo $chlorine_am1 ?>" maxlength="5"></td> <td class="main3"><input id="chlorine_am2" name="chlorine_am2" type="text" size="1" value="<?php echo $chlorine_am2 ?>" maxlength="5"></td> <td class="main3"><input id="ph_am1" name="ph_am1" type="text" size="1" value="<?php echo $ph_am1 ?>" maxlength="5"></td> <td class="main3"><input id="ph_am2" name="ph_am2" type="text" size="1" value="<?php echo $ph_am2 ?>" maxlength="5"></td> <td class="main3"><input id="chlorine_pm1" name="chlorine_pm1" type="text" size="1" value="<?php echo $chlorine_pm1 ?>" maxlength="5"></td> <td class="main3"><input id="chlorine_pm2" name="chlorine_pm2" type="text" size="1" value="<?php echo $chlorine_pm2 ?>" maxlength="5"></td> <td class="main3"><input id="ph_pm1" name="ph_pm1" type="text" size="1" value="<?php echo $ph_pm1 ?>" maxlength="5"></td> <td class="main3"><input id="ph_pm2" name="ph_pm2" type="text" size="1" value="<?php echo $ph_pm2 ?>" maxlength="5"></td> <td class="main3"><input id="combined_chl" name="combined_chl" type="text" size="1" value="<?php echo $combined_chl ?>" maxlength="4"></td> <td class="main3"><input id="alkalinity" name="alkalinity" type="text" size="1" value="<?php echo $alkalinity ?>" maxlength="3"></td> <td class="main3"><input id="chemicals_add" name="chemicals_add" type="text" size="1" value="<?php echo $chemicals_add ?>" maxlength="55"></td> <td class="main3"><input id="chemicals_qty" name="chemicals_qty" type="text" size="1" value="<?php echo $chemicals_qty ?>" maxlength="55"></td> <td class="main3"><input id="super_oxidation" name="super_oxidation" type="text" size="1" value="<?php echo $super_oxidation ?>" maxlength="3"></td> <td class="main4" class="main3"> </td> </tr> <tr> <td class="main4" colspan="24"> </td> </tr> <form method=post name=alkform> <tr> <td class="main2" colspan="3"> </td> <td class="main2" colspan="5"><b>Whirlpool Calculations</b></td> <td class="main2" colspan="5"> </td> <td class="main2" colspan="5"><b>Chlorine Shocking</b></td> <td class="main2" colspan="2"><b>FAS-DPD</b></td> <td class="main2" colspan="3"><b>Chlorine No-Shock</b></td> <td class="main2"> </td> </tr> <tr> <td class="main4" rowspan="3" colspan="3"> </td> <td class="main2" colspan="2">Alkalinity</td> <td class="main2"><input type=text name=alkalinity size=3></td> <td class="main2" colspan="2"> </td> <td class="main2" colspan="2">Calcium</td> <td class="main2"><input id="Calcium" name="Calcium" type="text" size="1" value="<?php echo $Calcium ?>" maxlength="3"></td> <td class="main2" colspan="2"> </td> <td class="main2" colspan="3">Drops</td> <td class="main2"><input id="R0871_drops" name="R0871_drops" type="text" size="1" value="<?php echo $R0871_drops ?>" maxlength="3"></td> <td class="main2" colspan="2">Breakpoint</td> <td class="main2"><?php echo $Breakpoint ?></td> <td class="main2" colspan="2">Needs to be:</td> <td class="main2"><input id="Chl_Needs" name="Chl_Needs" type="text" size="1" value="<?php echo $Chl_Needs ?>" maxlength="3"></td> <td class="main4" rowspan="3"> </td> </tr> <tr> <td class="main2" colspan="2">Needs to be:</td> <td class="main2"><input type=text name=alkneeds size=3></td> <td class="main2">Change:</td> <td class="main2"><input type=text name=alkchange size=3></td> <td class="main2" colspan="2">Needs to be:</td> <td class="main2"><input id="Cal_Needs" name="Cal_Needs" type="text" size="1" value="<?php echo $Cal_Needs ?>" maxlength="3"></td> <td class="main2"">Change:</td> <td class="main2"><?php echo $Cal_Change ?></td> <td class="main2" colspan="3">Free Chl</td> <td class="main2"><?php echo $Free_Chl ?></td> <td class="main2">ppm</td> <td class="main2" colspan="2">Amt to shock</td> <td class="main2" colspan="2">Change Required</td> <td class="main2"><input id="Chl_Change" name="Chl_Change" type="text" size="1" value="<?php echo $Chl_Change ?>" maxlength="3" readonly></td> </tr> <tr> <td class="main2" colspan="3">Add Sodium BiCarb</td> <td class="main2"><input type=text name=addoz size=3></td> <td class="main2">Oz</td> <td class="main2" colspan="3">Add Calcium</td> <td class="main2"><?php echo $Cal_Add_oz ?></td> <td class="main2">Oz</td> <td class="main2" colspan="3">Drops</td> <td class="main2"><input id="R0003_drops" name="R0003_drops" type="text" size="1" value="<?php echo $R0003_drops ?>" maxlength="3"></td> <td class="main2"> </td> <td class="main2"><?php echo $AmtShk_oz ?></td> <td class="main2">oz</td> <td class="main2" colspan="2">Add this in oz</td> <td class="main2"><input id="Chl_Add" name="Chl_Add" type="text" size="1" value="<?php echo $Chl_Add ?>" maxlength="3"></td> </tr> <tr> <td class="main4" colspan="6"> </td> <td class="main2"><input type=text name=addlbs size=3></td> <td class="main2">Lbs</td> <td class="main2" colspan="3"> </td> <td class="main2"><?php echo $Cal_Add_lbs ?></td> <td class="main2">Lbs</td> <td class="main2" colspan="3">Combined Chl</td> <td class="main2"><?php echo $Comb_Chl ?></td> <td class="main2">ppm</td> <td class="main2"><?php echo" ".number_format($AmtShk_gal,2); ?></td> <td class="main2">Gal</td> <td class="main4" colspan="6"> </td> </tr> <tr> <td colspan="24" align="center" class="main2">Make your changes and click the update button below.</td> </tr> <tr> <td colspan="24" align="center" class="main2"><input type=button name=alk value="Calculate" onClick="javascript:solveALK(this.form)"></form> <input type="button" value="Update" onclick="this.form.action='updated.php'; this.form.submit();"><input type="hidden" name="id" value="id"> <INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"></td> </tr> </table> </form> </center> If I am correct that I need to separate the forms. How do I do so? Or am I going about this wrong? Hello, I have a tricky one here. What I have is a form where the user would enter in their food recipe. There is nothing clever in that until I need them to enter in the ingredients and the quantity into 2 seperate fields. The issue is that I don't know how many different ingredients there would be for the recipe so from within the form before the record is saved I need them to be able to fill out the 2 fields as many times as they need to (pressing a button each time) and I would have thought for the data to be held in a javascript array that i could then write away into the mysql table? I probably haven't made much sense. Can anyone help? Okay well here is my code. i want to mkae it so the functions add together to get a total price, i need some help Code: <html> <head> </head> <script type="text/javascript"> function addit(){ if(document.getElementById("add").value=="0") { document.getElementById("amount").value="$0.00" } if(document.getElementById("add").value=="1") { document.getElementById("amount").value="$5.00" } if(document.getElementById("add").value=="2") { document.getElementById("amount").value="$10.00" } if(document.getElementById("add").value=="3") { document.getElementById("amount").value="$15.00" } } function addit2(){ if(document.getElementById("add2").value=="4") { document.getElementById("amount").value="$30.00" } if(document.getElementById("add2").value=="5") { document.getElementById("amount").value="$40.00" } } </script> <body> <table class="comparison pricing-email" border="0" cellspacing="1" cellpadding="0" width="30%"> <tbody> <tr class="row1"> <td class="col1">Choose # of EMAIL accounts: <select style="width: 60px; font-size: 17px;" name="add" id="add" onChange="addit()"> <option value="0"> </option> <option value="1">1</option> <option value="2">3</option> <option value="3">6</option> </select> </td> </tr> <tr class="row2"> <td class="col2">Choose # of EMAIL accounts: <select style="width: 60px; font-size: 17px;" name="add" id="add2" onChange="addit2()"> <option value="0"> </option> <option value="4">44</option> <option value="5">43</option> <option value="3">342</option> </select> </td> </tr> <tr class="row1"> <td class="col1">Total Price: <input type="text" id="amount" value="" style="border:none; font-size:13pt;"></td> </tr><tr> <td> <input type="submit" name="submit" value="Sign-Up"> </td> </tr> </tbody> </table> </form> </body> Hi , I want to make few forms but 1 submit button. I want to do 1 page , 5 forms , 1 submit button so when i click on the submit button it will send the 5 forms as 1 form. how I can so that? thanks , Mor. I'm having a total brain fart as to why this is happening. I just transferred my company's website from aplus.net servers to a linux based server on GoDaddy. My company's "shop" page has a drop down menu which should automatically re-direct you to a different page (on a different website where our shopping cart is hosted) when the option is selected. For some reason, after the switch to a different host, the option tags are no longer re-directing to the proper pages. Instead, they just tack on the value URL onto the existing URL and i just go in circles. javascript: <script language="JavaScript" type="/text/javascript"> function nav() { var w = document.myform.mylist.selectedindex.html; var url_add = document.myform.mylist.options[w].value; window.location.href = url_add; } </script> HTML for options form: <FORM NAME="myform"> <SELECT NAME="mylist" onChange="nav()"> <OPTION VALUE="http://bedvoyage.com/shop">Select Your Product <OPTION VALUE="http://bedvoyage.myshopify.com/products/twin-sheet-set">Sheet Set - Twin - $139.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/double-sheet-set">Sheet Set - Double - $159.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/queen-sheet-set">Sheet Set - Queen - $179.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/king-sheet-set">Sheet Set - King - $199.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/twin-pillow-case">Pillow Case - Twin - $20.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/double-pillow-case">Pillow Case Set - Double - $40.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/queen-pillow-case">Pillow Case Set - Queen - $42.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/king-pillow-case">Pillow Case Set - King - $45.00 <option value="http://bedvoyage.myshopify.com/products/zippered-travel-pillow-case">Zippered Travel Pillow Case - $19.00 <!-- <OPTION VALUE="http://bedvoyage.myshopify.com/produ...uot;>Travel Blanket - $39.00 --> </SELECT> </FORM> Is there an option on godaddy that i'm just missing out on that i'm too ignorant to notice? Thanks in advance. Hi all - I'm having difficulty with the processing of 3 forms on my web page. We'll call my 3 forms A, B, and C. By default my page shows form A. The other 2 forms I have hidden via display:none My issue is when I have form B or C showing. Once I hit submit, say within form B for example, I'd like this form to remain for future entries/submital of data. However, instead what happens is form A appears. How do I get form B to remain, allowing for a user to submit multiple entries of data without going back to form A? Here's my code for form 'B' <div id="branches_info" style=" <?php echo $display_branches; ?> "> form method="post" action="annual_report_main.php" onsubmit="return validateBranches(this);"> <fieldset> <p><strong>Branch Location</strong></p><br /> <label for="branch_address" class="long">Street Address:</label> <input maxlength="50" type="text" name="branch_address" id="branch_address" value="<?php echo htmlentities($_POST['branch_address']);?>" /><br /> <div class="cleaner"></div> <label for="branch_city" class="long">City:</label> <input maxlength="20" type="text" name="branch_city" id="branch_city" value="<?php echo htmlentities($_POST['branch_city']);?>" /><br /> <div class="cleaner"></div> <label for="branch_state" class="long">State:</label> <input maxlength="2" type="text" name="branch_state" id="branch_state" value="<?php echo htmlentities($_POST['branch_state']);?>" /><br /> <div class="cleaner"></div> <label for="branch_zip" class="long">Zip Code:</label> <input maxlength="10" type="text" name="branch_zip" id="branch_zip" value="<?php echo htmlentities($_POST['branch_zip']);?>" /><br /> <div class="cleaner"></div> <div class="content_onecolumn"> <input type="submit" name="Branches" value="Submit to Database" class="inputSubmit" /> </div> <div class="content_onecolumn"> <input type="button" name="Finished" value="Finished" class="inputSubmit" onclick="window.open('https://www.dca.ca.gov/webapps/bppe/thankyou.php');return false" /> </div> </fieldset> </form> </div> the following javascript code is for a page that has to different login sections (username and password) hospital admin i want them to login in their part using normal IDs(numbers) and password, and normal users to login in the other login boxes (using email address and password) , each login boxes have their own submit button. the problem is i can't check each of them alone. what i want to do is that if (for user) email and password entered and pressed his login button, to be headed to another page, while if hospital admin entered his id and password in his section and pressed login button, to be headed for a different page. help please ! Code: window.onload = initForms; function initForms() { for (var i=0; i< document.forms.length; i++) { document.forms[i].onsubmit = function() {return checkFields();} } } function checkFields(){ if(document.getElementById("userLogin").onclick) { if(isEmail(document.getElementById("userUsername").value)==false) { alert("Please enter a valid e_mail address."); document.getElementById("userUsername").focus(); return false; } if(document.getElementById("userUsername").value=="") { alert("Please enter your e_mail address."); document.getElementById("userUsername").focus(); return false; } if(document.getElementById("userPassword").value=="") { alert("Please enter your password."); document.getElementById("userPassword").focus(); return false; } } if(document.getElementById("hospLogin").onclick) { if(document.getElementById("hospUsername").value=="") { alert("Please enter your ID."); document.getElementById("hospUsername").focus(); return false; } if(document.getElementById("hospPassword").value=="") { alert("Please enter your password."); document.getElementById("hospPassword").focus(); return false; } } } function isEmail(mail) { var char1 = mail.split("@"); var y = mail.indexOf("@", 0); var e = mail.indexOf(".", 0); var w = mail.lastIndexOf(".", mail.length - 1); var sp = mail.indexOf(" ", 0); var pl = mail.indexOf("@.", 0); for (i = 0; i < mail.length; i++) { if (mail.charAt(i) == "/" || mail.charAt(i) == ":" || mail.charAt(i) == ";" || sp > 0 || pl > 0 || mail.charAt(i) == '"' || char1.length > 2 || y == -1 || y == 0 || e == 0 || w == mail.length - 1 || e == -1) { return false; } } } and there goes the HTML codes: 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" /> <link rel="stylesheet" href="script.css" /> <script type="text/javascript" src="script.js"></script> <title>Blood high res END</title> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <div id="apDiv4" style="background:url(images/Blood-high-res-END_04.jpg) no-repeat"></div> <div id="apDiv1" style="background:url(images/Blood-high-res-END_01.jpg)"> <p>Hospital</p> <form name="hospForm" id="hospForm"> <input type="text" name="hospUsername" id="hospUsername" class="reqd" /><br /> <input name="hospPassword" type="password" id="hospPassword" class="reqd" /><br /><br /> <input name="submit" type="submit" id="hospLogin" value="Hospital log in" /></form></div> <div id="apDiv2" style="background:url(images/Blood-high-res-END_02.jpg)"></div> <div id="apDiv3" style="background:url(images/right.jpg)"> <a id="register" href="../User Registration Page/page.html" target="_self">Register Now</a> <a id="links" href="../Links/page.html" target="_self">Links</a> <p>Visitor</p> <form name="userForm" id="userForm"> <input type="text" name="userUsername" id="userUsername" class="reqd" /><br /> <input name="userPassword" type="password" id="userPassword" class="reqd" /><br /><br /> <input name="submit" type="submit" id="userLogin" value="User log in" /><br /></form> <a id="register2" href="../User Registration Page/page.html" target="_self">Register now</a><br /> <a id="forgot" href="../User Forgot Password/page.html" target="_self">Forgot Password</a></div> <div id="apDiv5" style="background:url(images/Blood-high-res-END_05.jpg) no-repeat"></div> <div id="apDiv6" style="background:url(images/Blood-high-res-END_06.jpg) no-repeat"> <p>Hello and welcome to Red Drop. By visiting our page,<br />you ensure to each and every one of the team crew <br />behind the stage, and to every lebanese person that<br />you are mentally prepared to donate a few drops of your<br />blood to the benefit of an anonymous stranger.<br /><br />With every drop you donate, you might be giving<br />a father, a mother or a child another day to live among<br />his family and his beloved persons.<br /><br />Register today and add donation blood to your frequently<br />social and humanitarian activities.</p> </div> <div id="apDiv7" style="background:url(images/Blood-high-res-END_07.jpg) no-repeat"></div> <div id="apDiv8" style="background:url(images/Blood-high-res-END_08.png) no-repeat"></div> <div id="apDiv9" style="background:url(images/Blood-high-res-END_09.jpg) no-repeat"></div> </body> </html> I havent added the server side scripts yet, i am planning to validate forms as much as possible using javascript first, and this is not for a real hospital, it's a graduation project, so to explain the point, on the page i have 2 seperated forms wich each having its own submit button, one to be used by hospital admins, and other to be used by users. For admins i just want to make sure their fields are not empty. For users i want to make sure their fields are not empty and their email field is valid. but when trying it, it's kinda only checks for the user fields. P.S: I apologize about not using codes, i didn't knew about this option. Hello. I am using javascript to create a dynamic form to allow me to add multiple items to the form before posting... this is the code: Code: if (!$_POST) { ?> <title>Adding elements to a form</title> <form name="form1" enctype="multipart/form-data" action="" method="post"> <div ID="Items"> <b>Dog 1:</b> <input type="text" name="Item1" size="45"> <br> <input type="button" value="Add Item" onClick="AddItem();" ID="add"> <input type="submit" name ="submit" value="Submit Form" > </div> </form> <? } else { echo print_r ($_POST); } ?> <script language="javascript"> var items=1; function AddItem() { div=document.getElementById("Items"); button=document.getElementById("add"); items++; newitem="<b>Dog " + items + ": </b>"; newitem+="<input type=\"text\" name=\"Item" + items ; newitem+="\" size=\"45\"><br>"; newnode=document.createElement("span"); newnode.innerHTML=newitem; div.insertBefore(newnode,button); } </script> It works but each element in the printed post array shows as Item1, Item2 etc with each being a seperate array... How can I make it so that I have a single posted array called Item with that array then having elements Item[1] etc up to the number of elements I add... Any help would be appreciated I am building a website for a client. This will involve some tricky form work. There will be forms on 2 pages. The first will be of generic questions such as: "How many windows in you household?" After these questions are answered, a "Continue" button would be pressed. Then "Do you want your windows cleaned?" would be an option on the second page. At the end of that form on the second page, it would calculate the true answers with the filled in info from the first page. This is the way the client wants it. How would I go about this? I've been looking for ways to get seperate forms to cooperate with each other, I'd assume with ID tags and such, but can't find any good help. Any insight would be great!! |