JavaScript - Validate Valid Date Form With Dropdown Boxes
Similar Tutorialsfigured out, sorry
Hello all, I have a form that submits a POST request when data is submitted. A Servlet then processes this POST request and a JavaBean is used to make some calculations. The HTML response is not generated within the Servlet but instead I forward the request to a JSP to generate the response. - This all works fine, thankfully. However, I am stupidly suck trying to validate the form on the client side with a JavaScript function before the form is submitted. Here is my index.jps: Code: <%-- Document : index Created on : 19-Nov-2009, 13:41:30 Author : lk00043 --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/JavaScript"> <!-- Start hiding JavaScript Statements function validateForm() { var student; var score1, score2, score3, score4; student = document.getElementById('student'); s1 = document.getElementById('score1'); s2 = document.getElementById('score2'); s3 = document.getElementById('score3'); s4 = document.getElementById('score4'); score1 = parseInt(s1.value); score2 = parseInt(s2.value); score3 = parseInt(s3.value); score4 = parseInt(s4.value); if(student.value.length == 0) { document.getElementById('StudentError1').innerHTML = " Enter a student name!"; return false; } if ((isNaN(score1)) || (score1 < 0) || (score1 > 100)) { document.getElementById('Error1').innerHTML = " Enter a number between 0 and 100!"; return false; } if ((isNaN(score2)) || (score2 < 0) || (score2 > 100)) { document.getElementById('Error2').innerHTML = " Enter a number between 0 and 100!"; return false; } if ((isNaN(score3)) || (score3 < 0) || (score3 > 100)) { document.getElementById('Error3').innerHTML = " Enter a number between 0 and 100!"; return false; } if ((isNaN(score4)) || (score4 < 0) || (score4 > 100)) { document.getElementById('Error4').innerHTML = " Enter a number between 0 and 100!"; return false; } } // End hiding JavaScript Statements --> </script> <title>Lab Class 7 - Task 2</title> </head> <body> <h1>Lab Class 7</h1> <form name="collectgrades" action="AssessGrades" method="POST" onSubmit="validateForm()" > Name of Student: <input type="text" name="student" id="student"/><span id="StudentError1"> </span><br /> Presentation: <input type="text" name="score" id="score1"/><span id="Error1"> </span><br /> Writing style: <input type="text" name="score" id="score2"/><span id="Error2"> </span><br /> Technical content: <input type="text" name="score" id="score3"/><span id="Error3"> </span><br /> Depth of analysis: <input type="text" name="score" id="score4"/><span id="Error4"> </span><br /> Feedback:<select name="feedback" size="4" multiple="multiple"> <option>"Could be better structured."</option> <option>"Depth of analysis is good."</option> <option>"Very advanced material."</option> <option>"Very well structured."</option> </select><br /> <input type="submit" value="Submit" /> </form> </body> </html> Regardless of whether incorrect input is given, the data is still POSTed to the server and calculated on or a Server Side error is given. Am I correct in calling the function onClick? The validation essentially needs to be so that: - Student field contains a string - Score1, Score2, Score3 and Score 4 contain a number between 0 and 100 Any help is most appreciated, Cheers, Beetle. Hello, First I would like to say I am not a coder. I would like to have a specific date range in years entered into a text box and if anything else is entered a pop up alert would appear. The date range would be from 1912 to 2002. Any help with this would be greatly appreciated. I am using Joomla 2.5 and a form constructor called RS Form Pro That allows JS to be used. This is the Javascript I am trying to use: Code: <script type="text/javascript"> function checkDate(theForm) year=document.getElementById('YearBorn').value; if(year<1912 || year>2002) { alert("registration is restricted to those born between 1912 to 2002"); return false; else { return true; } } </script> This is how I am trying to call it Code: onblur="return checkDate(this);" I am not sure if I am calling it correctly or if the JS code is even correct. When the user enters the date and it is not within the date range I need the alert to pop up. Thank you for any help you can provide DeZiner I am trying to make a unit converter with two dropdown boxes, two textfields and a button. I want to enter a number into the first textfield, select a unit option, then select another appropriate unit option based on the first selection, press the button and get the result in the second textfield. What would be the best approach for this. So far I have: <html> <head> <script type="text/javascript"> function convertUnit () { // convert pound to kilogram document.unitForm.toField.value = document.unitForm.fromField.value / 2.2; // convert kilogram to pound document.unitForm.toField.value = document.unitForm.fromField.value * 2.2; // convert inch to centimeter document.unitForm.toField.value = document.unitForm.fromField.value / 2.54; // convert centimeter to inch document.unitForm.toField.value = document.unitForm.fromField.value * 2.54; } </script> </head> <body style="background-color:lightgray"> <form action="" name="unitForm"> <input type="text" name="fromField" onfocus="this.form.fromField.value=''; style.background='lightyellow';" onblur="style.background='white';" /> <select name="fromList" > <option value="" selected="selected">Unit</option> <option id="fromPound" value="2.2">lb</option> <option id="fromKilogram" value="1.0">kg</option> <option id="fromInch" value="1.0">in</option> <option id="fromCentimeter" value="2.54">cm</option> </select> <input type="button" value="Convert" onclick="convertUnit()" /> <input type="text" name="toField" readonly="readonly" /> <select name="toList"> <option value="" selected="selected">Unit</option> <option name="toKilogram" id="toKilogram" value="1.0">kg</option> <option name="toPound" id="toPound" value="2.2">lb</option> <option name="toCentimeter" id="toCentimeter" value="2.54">cm</option> <option name="toInch" id="toInch" value="1.0">in</option> </select> <input type="reset" value="Reset" /> </form> </body> </html> Hi everybody. I'm new to both Javascript and this site, so apologies if this isn't the right way to be asking this question. Here's what I'm trying to do. I've got two dropdown boxes ('language' and 'word'). When the submit button is pressed, I want a div to show with the right word in it. I can do this fine with one dropdown box, but two has got me stumped. Any ideas would be much appreciated. S Complete newbie to JS, If button is clicked, want form to be validated. If the validation passes then bring up print dialogue I have got the validation (using dreamweaver) working, however if the form is correct , how do I get the print dialogue (window.print()) to appear? here's the code Code: <script language="JavaScript" type="text/JavaScript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="" ) { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } //--> </script> Code: <td><input name="Name" type="text" id="Name" size="50" maxlength="50"></td> <input name="Button" type="button" onClick="MM_validateForm('Name','','R');return document.MM_returnValue" value="Button" /> Code: <script type="text/javascript"> /*********************************************** * Drop Down Date select script- by JavaScriptKit.com * This notice MUST stay intact for use * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more ***********************************************/ var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec']; function populatedropdown(dayfield, monthfield, yearfield){ var today=new Date() var dayfield=document.getElementById(dayfield) var monthfield=document.getElementById(monthfield) var yearfield=document.getElementById(yearfield) for (var i=0; i<31; i++) dayfield.options[i]=new Option(i, i+1) dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day for (var m=0; m<12; m++) monthfield.options[m]=new Option(monthtext[m], monthtext[m]) monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month var thisyear=today.getFullYear() for (var y=0; y<20; y++){ yearfield.options[y]=new Option(thisyear, thisyear) thisyear+=1 } yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year } </script> This script when the year is selected chooses 2011-2030 but I want like 1900-2011 How do I fix this and then how would I make sure that it isn't blank and then sends this data to one field in my database called "dob" in form "0000-00-00".. thanks.. Javascript novice here looking to create a dynamic dropdown based on date. It's a list of preset prices that will change each month to reflect a pro-rated system. Any thoughts/examples on how I would go about setting this up using javascript would be much appreciated. Thanks. Here's what I need: In September, the dropdown will display these prices Code: <option value="100">Product 1</option> <option value="150">Product 2</option> <option value="200">Product 3</option> In October, the dropdown will display these prices <option value="50">Product 1</option> <option value="100">Product 2</option> <option value="150">Product 3</option> Please see my Booking Form here http://www.n-v-m.co.uk/Booking.html The form is very nearly finished but I have no experience with JavaScript at all so I am hoping somebody can tell me how to do the finishing touches. All I require is: 1- On clicking the 'Submit order' button I would like the browser to check to see if the 'Is Vehicle roadworthy with full M.O.T.:' List/Menu is set to 'Yes' and if not it needs to return an alert stating it must be set to 'Yes' to proceed... Somebody kindly helped show me how to do the alert before so this is working, but, the problem at the moment is after clicking 'OK' to close the alert, the form is still submitted. At this point instead of the form being submitted I would just like the browser to return to the form. 2- There is a checkbox on the bottom of the form that states 'I agree with the Terms and Conditions'... To be able to proceed with a booking I need the customer to check the box... On clicking 'Submit order' if the box isn't checked I would like an alert to appear and the form not to be submitted. 3. When both the above criteria have been met and the form is ready to submit... I would like the browser to re-direct to http://www.n-v-m.co.uk/Thankyou.html which is a page I have already created on my server. Thanks for taking your time to read this... If it helps I have posted both my HTML and PHP codes below: Booking.html 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>National Vehicle Movements - Booking Form</title> <style type="text/css"> <!-- body { background-color: #1d255f; margin: 0px; padding: 0px; } #apDiv1 { position:absolute; width:487px; height:706px; z-index:auto; left: 50%; top: 433px; font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; text-align: center; textarea-align: center; background-position: center; margin-left: -244px; } --> </style> <script type='text/javascript'> function isValid() { var box = document.getElementById('Is Vehicle Roadworthy with Full M.O.T.'); if(box.value = 'no') { alert('The vehicle must be roadworthy with full M.O.T'); return false; } } </script> </head> <body> <div align="left"> <div id="apDiv1"> <form id="form1" name="form1" method="post" action="sendform.php" onsubmit='validatethis()'> <table width="400" border="0" align="center"> <tr> <td width="193" align="right">Company:</td> <td width="197" align="left"><input type="text" name="company" id="Company" /></td> </tr> <tr> <td align="right">Name:</td> <td align="left"><input type="text" name="name" id="Name" /></td> </tr> <tr> <td align="right">Phone Number:</td> <td align="left"><input type="text" name="phonenum" id="Phone Number" /></td> </tr> <tr> <td align="right">Email Address:</td> <td align="left"><input type="text" name="email" id="Email" /></td> </tr> <tr> <td align="right">Vehicle Make and Model:</td> <td align="left"><input type="text" name="vmam" id="Vehicle Make and Model" /></td> </tr> <tr> <td align="right">Vehicle Reg./Ref. No.:</td> <td align="left"><input type="text" name="vreg" id="Vehicle Reg." /></td> </tr> <tr> <td align="right">Collection Address including Postcode:</td> <td align="left"><textarea name="colladd" rows="4" id="Collection Address"></textarea></td> </tr> <tr> <td align="right">Collection Contact Name:</td> <td align="left"><input type="text" name="collconname" id="Collection Contact Name" /></td> </tr> <tr> <td align="right">Collection Contact Number:</td> <td align="left"><input type="text" name="collconnum" id="Collection Contact Number" /></td> </tr> <tr> <td align="right">Delivery Address including Postcode:</td> <td align="left"><textarea name="deladd" rows="4" id="Delivery Address"></textarea></td> </tr> <tr> <td align="right">Delivery Contact Name:</td> <td align="left"><input type="text" name="delconname" id="Delivery Contact Name" /></td> </tr> <tr> <td align="right">Delivery Contact Number:</td> <td align="left"><input type="text" name="delconnum" id="Delivery Contact Number" /></td> </tr> <tr> <td align="right">Collection Date/Time:</td> <td align="left"><input type="text" name="collectiondt" id="Collection Date/Time" /></td> </tr> <tr align="center"> <td colspan="2" valign="top"><em>(if possible please give a time window eg. '7th - 9th August' and we will arrange collection for you)</em></td> </tr> <tr> <td align="right">Delivery Date/Time:</td> <td align="left"><input type="text" name="deliverydt" id="Delivery Date/Time" /></td> </tr> <tr align="center"> <td colspan="2" valign="top"><em>(if possible please give a time window eg. '7th - 9th August' and we will arrange delivery for you)</em></td> </tr> <tr> <td align="right">Is Vehicle Taxed:</td> <td align="left"><select name="Taxed" id="Is Vehicle Taxed"> <option>Yes</option> <option selected="selected">No</option> </select></td> </tr> <tr> <td align="right">Is Vehicle roadworthy with full M.O.T.:</td> <td align="left"><select name="mot" id="Is Vehicle Roadworthy with Full M.O.T."> <option>Yes</option> <option selected="selected">No</option> </select></td> </tr> <tr> <td align="right">Billing Address:</td> <td align="left"><textarea name="billadd" rows="3" id="Billing Address"></textarea></td> </tr> <tr align="center"> <td colspan="2" valign="top"><em>(if same as collection or delivery address please enter 'collection' or 'delivery')</em></td> </tr> <tr> <td align="right">Your Ref./Order No. (if any):</td> <td align="left"><input type="text" name="custordnum" id="Customer Ref./Order No." /></td> </tr> <tr> <td align="right">Any additional comments:</td> <td align="left"><textarea name="addcom" rows="3" id="Any additional comments"></textarea></td> </tr> <tr align="center" valign="middle"> <td colspan="2"> <p> <input type="checkbox" name="checkbox" id="checkbox" /> I agree with the <u><a href="Terms.html">Terms and Conditions</a></u></strong></p> <p> </p></td> </tr> <tr align="center"> <td colspan="2"><input type="submit" name="button" id="button" value="Submit order" onclick="isValid()" /> <input type="reset" name="button2" id="button2" value="Reset form" /></td> </tr> </table> </form> </div> </div> <div align="center"><img src="images/Booking_03.jpg" width="680" height="1352" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="36,155,158,173" href="index.html" alt="Home" /> <area shape="rect" coords="29,174,151,189" href="Prices.html" alt="Prices" /> <area shape="rect" coords="475,191,578,206" href="mailto:info@n-v-m.co.uk" alt="Email us" /> </map> </div> </body> </html> sendform.php Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <BODY> <?php $Name = $_POST['name']; //senders name $to = "info@n-v-m.co.uk"; //recipient $subject = "Order from ".$_POST['company']." (".$_POST['name'].")"; //subject $message = $_POST['company']."|".$_POST['name']."|".$_POST['phonenum']."|".$_POST['email']."|".$_POST['vmam']."|".$_POST['vreg']."|".$_POST['colladd']."|".$_POST['collconname']."|".$_POST['collconnum']."|".$_POST['deladd']."|".$_POST['delconname']."|".$_POST['delconnum']."|".$_POST['collectiondt']."|".$_POST['deliverydt']."|".$_POST['Taxed']."|".$_POST['billadd']."|".$_POST['custordnum']."|".$_POST['addcom']; //mail body $from = "NVM Booking Form"; // $headers = "From: ".$from."\r\n"; //optional headerfields mail($to, $subject, $message, $headers); //mail command :) you can add any variable here... I know you have so many, but it is possible... if(mail) echo "Booking confirmed. Thank You!"; else echo "Sorry We Can't Proceed, Please Try After Some Time!"; ?> </BODY> </HTML> I am trying to make validation for a form but the bit I am stuck on now is: Code: <input class="submit" type="submit" value="Submit" id="submit" name="submit" onclick="return validate();" /> Do I have to add 'verify' instead of the 'validate' I mean is this a set thing in JS as I want it to go to the JavaScript code which is validate.js I should add that the form is XHTML and there is also a captcha with it. So I would not know how to add the onsubmit to the beginning of the form. hello i am trying to do a validation form but i ended up with one that only works for chrome, not on IE not on Firefox! don't know why!!! and another problem it looks like that the return false doesn't even work, it proceeds to the next page anyway [HTML]function validate_required(field,alerttxt) { with (field) { if (value==null||value=="-1") { alert(alerttxt); return false; } else { return true; } } } /*function alertt(thisform) {alert(thisform);}*/ function validate_form(thisform) { //alert('hi'); with (thisform) { if (validate_required(i_am_a,"i_am_a must be filled out!")=="-1") {i_am_a.focus(); return false;} } [/HTML] [HTML]<form method="post" action="index.php?page=step2" onsubmit="return validate_form(i_am_a.options[i_am_a.selectedIndex].value);"> <table class="text"> <tr> <td class="text">أنا</td> <td> <select name="i_am_a" id="i_am_a"> <!--onchange="validate_form(i_am_a.options[i_am_a.selectedIndex].value);">--> <option selected value="-1">الرجاء التحديد</option> <option value="MSW">رجل يبحث عن إمرأة</option> <option value="WSM">إمرأة تبحث عن رجل</option> </select> </td> </tr><tr class="submit"> <td> </td> <td> <input type="submit" value="إنضمم الآن مجانا" /> </td> </tr> </table> </form>[/HTML] This is what I have so far, it is a template I copied from my working E-mail validation. I'm assuming I have to make it so it's just an array of numbers but I really don't know Java too well. Essentially I just want numbers only to be accepted into the phone field. Code: else if(fieldType == 'phone') { if((required == 1 && fieldObj.value=='') || (fieldObj.value!='' && !validate_phone(fieldObj.value))) { fieldObj.setAttribute("class","mainFormError"); fieldObj.setAttribute("className","mainFormError"); fieldObj.focus(); return false; } } function validate_phone(phoneStr) { apos=phoneStr.indexOf("@"); if (apos<1||dotpos-apos<2) { return false; } else { return true; } } hello cant get my head around this..i had a form posting data to my sql database but it would show the thank you using {if} ect so created java vaildation script what points it to ?action=registered showing thank you message but it not submitting to sql or sending notification email?? can any one help me? thanks dan thanks Hello in "validateField" function radio is not exists and I don't know how can I add a validation rule for radio buttons. please help me . my code is attached. thank you 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 I created a form and validation to ensure that it is fully filled out, then once it is filled out properly, it should automatically go to the confirmation page. The way it works right now is that it does work properly, except if the error alert pops up it will then navigate to the confirmation page anyways, and that page will be blank. I have it setup with this in the form: Code: <form name = "orderForm" action="confirmOrder.html" onsubmit= "validateOrder()"> I need it to stop on error, and not let you continue to confirmOrder.html unless filled out right. Good day. This form is working, but I want to make the "What AIS services are you interested in?" multiple selection a "required field". The other required fields are working, but I can't figure out how to make this field "required". Code: <blockquote><h2>Request More Information:</h2> <script type="text/javascript"> function MM_validateForm() { //v4.0 if (document.getElementById){ var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } } </script> <form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST" onsubmit="MM_validateForm('first_name','','R','last_name','','R','email','','RisEmail','company','','R','phone','','RisNum');return document.MM_returnValue"><input type="hidden" name="oid" value="00Dd0000000cnUc" /> <input type="hidden" name="retURL" value="http://aissolutions.ca/thank-you" /> <p style="float:left;width:350px"><label for="first_name">First Name <span style="color:#f00">(required)</span></label><input id="first_name" type="text" name="first_name" size="50" maxlength="40" /></p> <p style="float:left;width:350px"><label for="last_name">Last Name <span style="color:#f00">(required)</span></label><input id="last_name" type="text" name="last_name" size="50" maxlength="80" /></p> <p style="float:left;width:350px"><label for="email">Email <span style="color:#f00">(required)</span></label><input id="email" type="text" name="email" size="50" maxlength="80" /></p> <p style="float:left;width:350px"><label for="company">Company <span style="color:#f00">(required)</span></label><input id="company" type="text" name="company" size="50" maxlength="40" /></p> <p style="float:left;width:350px"><label for="phone">Phone <span style="color:#f00">(required)</span></label><input id="phone" type="text" name="phone" size="50" maxlength="40" /></p> <p style="float:left;width:350px">Best Time To Call:<select style="width:325px" id="00Nd0000004F2Mb" name="00Nd0000004F2Mb" title="Best Time To Call"><option value="">--None--</option><option value="9:00am to 12:00pm">9:00am to 12:00pm</option> <option value="1:00pm to 5:00pm">1:00pm to 5:00pm</option> <option value="6:00pm to 9:00pm">6:00pm to 9:00pm</option> </select></p> <p style="clear:left;float:left;width:350px"><label for="street">Address</label><br> <textarea name="street" cols="47"></textarea></p> <p style="float:left;width:350px">What AIS services are you interested in?:<select style="width:325px" id="00Nd00000043aHr" multiple="multiple" name="00Nd00000043aHr" title="What AIS services are you interested in?"><option value="Bookkeeping">Bookkeeping</option> <option value="Business Incorporation">Business Incorporation</option> <option value="Catch Up/Clean Up Records">Catch Up/Clean Up Records</option> <option value="Job Costing">Job Costing</option> <option value="Part Time CFO">Part Time CFO</option> <option value="Software Conversion">Software Conversion</option> <option value="Software Customization">Software Customization</option> <option value="Software Training">Software Training</option> <option value="Tax Services">Tax Services</option> </select></p> <p style="float:left;width:350px">Anything else you think we should know:<br> <textarea id="00Nd0000004E2rs" name="00Nd0000004E2rs" cols="47"></textarea></p> <p style="clear:left;float:left"><input type="submit" name="submit" /></p> Thanks. what can be the reasons for the same code which works perfectly in notepad to not show its result in a jsp application done using eclipse??anything to do with settings? I am not able to display the current date as default in dd/mm/yyyy format in drop down boxes..only dd and yyyy apears but month isnt apearing as default.. can u suggest alternative logic and its code to implement the same?? I am Gururaj. I have written a form in HTML which contains username,lastname,email,password and submit. I have written a javascript to validate this form [validate(username,lastname,email,password)]. On submit this javascript function will be called and hence form get validated. I am passing all the arguements(username,lastname,email and password) to the javascript function.. Is it possible to make me a code such that it should call an individual function for each field in the form.for ex:if i have not entered username, last name in the form and attempt to submit, only username arguement should be passed to the function as it comes first in the form. In other sense i want to validate individual text field validation of my form. So can anybody help me.It will be very needful to me. |