JavaScript - A Form That Generates Html
Hello experts ;p
I'm new and i found this forums within google. I been stuck in a whole pile of thoughts and whatnot. I run a website for music community and basically postings of artists and their info.. Now a lot of my posters and specially the new ones don't know HTML at all so i'm the only one with HTML experience. So basically think in a way Wordpress. Authors need to post info about a band or artist .. Now it's a long progress to do by hand the same format and whatnot so what i need is i have already a layout i made in dreamweaver but the info is all marked as "Default Info" To put this short, i need so that my authors just fill out a Form that has all the required fields like "Bands Name" "Bands Bio" and they fill in the boxes. Now i those values to go in a Textarea so they just copy all the HTML and just paste it in the submission page so they all have the same format... Now i know how to make a form but using values from a form to go in a predefined html page so like.. would go on a page like this. Code: <html> <body> <h1>Value Band Name Here</h1> <br> <br> <h2>Band Biography</h2> <br> <VALUE Band BIO Here> <br> Albums :<br> <VALUE ALBUM NAME, VALUE ALBUM YEAR,<br> <br> <img src="ALBUM ART LOCATION VALUE HERE"> And so on.. Do you guys catch my drift? So they fill a form that then they click GENERATE CODE and the above goes in a textarea they copy from but the values are already filled from the form so it doesn't show up as <VALUE BAND NAME> it would just show what you filled in.. Any help would solve this problem that i been having for the past 3 months. Thank you if any help! PSSS I had this from someone but when i modified it , i broke it.. Is there a simpler way? PHP Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>band form</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> * { margin:0; padding:0; } body { background-color:white; } label, textarea { display:block; } </style> <script type="text/javascript"> window.onload=function() { document.getElementById('band').onsubmit=function() { var bandname=document.getElementById('bandname').value; var bio=document.getElementById('bio').value; var album1=document.getElementById('album1').value; var album1y=document.getElementById('album1y').value; var album1i=document.getElementById('album1i').value; var album2=document.getElementById('album2').value; var album2y=document.getElementById('album2y').value; var album2i=document.getElementById('album2i').value; var album3=document.getElementById('album3').value; var album3y=document.getElementById('album3y').value; var album3i=document.getElementById('album3i').value; var text="<h1>"+bandname+"</h1>\n\r<h2>Band Biography</h2>\n\r<p>"+bio+"</p>\n\r<h3>Albums</h3>\n\r<ul>\n\r<li>"+album1+" : "+album1y+" <img alt=\""+album1+"\" src=\""+album1i+"\"></li>\n\r<li>"+album2+" : "+album2y+" <img alt=\""+album2+"\" src=\""+album2i+"\"></li>\n\r<li>"+album3+" : "+album3y+" <img alt=\""+album3+"\" src=\""+album3i+"\"></li>\n\r</ul>"; document.getElementById('code').value=text; return false; } } </script> </head> <body> <form id="band" action="#"> <label>Band name: <input type="text" id="bandname"></label> <label for="bio">Band bio: </label> <textarea rows="20" cols="80" id="bio"></textarea> <label>Album 1: <input type="text" id="album1"></label> <label>Album 1 year: <input type="text" id="album1y"></label> <label>Album 1 image location: <input type="text" id="album1i"></label> <label>Album 2: <input type="text" id="album2"></label> <label>Album 2 year: <input type="text" id="album2y"></label> <label>Album 2 image location: <input type="text" id="album2i"></label> <label>Album 3: <input type="text" id="album3"></label> <label>Album 3 year: <input type="text" id="album3y"></label> <label>Album 3 image location: <input type="text" id="album3i"></label> <input type="submit"> </form> <p>Copy this:</p> <textarea rows="20" cols="80" id="code"></textarea> </body> </html> Similar TutorialsHello I needed an interdependent form for my website and found a JavaScript that would do the trick. Now i have no knowledge in JavaScript but i managed to set this up right. But i seems some part of the script makes a popup window which is showing what is chosen in the form and i reeeally want to remove that Can anyone pick out which piece of the script i need to remove? Thanks in advance Code: var ss2Values = [ // 'Please choose a subject' ['Please choose a category'], // '3D Printer' ['Please choose a category', 'Darwin', 'Huxley', 'MendelMax', 'Original Mendel', 'Printrbot', 'Prusa Mendel', 'Wallace', 'Upgrades'], // 'Home' ['Please choose a category', 'Bathroom', 'Bedroom', 'Decorations', 'Furniture', 'Home utilities', 'Household items', 'Kitchen', 'Livingroom', 'Outdoor', 'Spareparts'], // 'Mechanical' ['Please choose a category', 'Gears', 'Nuts and bolts', 'Tracks and bogies'], // 'Electrical' ['Please choose a category', 'Battery boxes', 'Terminal blocks', 'Outlet boxes'], // 'Electrical' ['Please choose a category', 'Architectural', 'Games', 'Ornaments', 'Toys'], // 'Educational' ['Please choose a category', 'Biological models', 'Chemical models', 'Mathematical', 'Physical models'] ]; window.onload = function() { var ss2 = new xSubSelect('sel20', 'sel21', null, ss2Values, ss2OnChange); } function ss1OnChange(s0, s1, s2) { alert( s0.options[s0.selectedIndex].value + ' / ' + s1.options[s1.selectedIndex].value + ' / ' + s2.options[s2.selectedIndex].value ); } function ss2OnChange(s0, s1) { alert( s0.options[s0.selectedIndex].value + ' / ' + s1.options[s1.selectedIndex].value ); } function xSubSelect(sSelId0, sSelId1, sSelId2, aValues, fnOnChange) { var s0 = document.getElementById(sSelId0); var s1 = document.getElementById(sSelId1); var s2 = sSelId2 ? document.getElementById(sSelId2) : null; if (s0 && s1) { s0.onchange = function() { var i, len, val; // clear existing options for s1 len = s1.options.length; for (i = 0; i < len; ++i) { s1.options[0] = null; } // insert new options for s1 len = aValues[s0.selectedIndex].length; for (i = 0; i < len; ++i) { val = aValues[s0.selectedIndex][i]; s1.options[i] = new Option(s2 ? val[0] : val); } // update s2 if (s2) { s1.onchange(); } }; if (s2) { s1.onchange = function() { var i, len; // clear existing options for s2 len = s2.options.length; for (i = 0; i < len; ++i) { s2.options[0] = null; } // insert new options for s2 len = aValues[s0.selectedIndex][s1.selectedIndex].length; for (i = 1; i < len; ++i) { s2.options[i - 1] = new Option(aValues[s0.selectedIndex][s1.selectedIndex][i]); } }; s2.onchange = function() { if (fnOnChange) { fnOnChange(s0, s1, s2); } }; } else { s1.onchange = function() { if (fnOnChange) { fnOnChange(s0, s1); } }; } s0.onchange(); // first init } } If I have a javascript var in a webpage(html form textarea VALUE - yui) that contains html code, and want to appear it, in confirmformpage.php, then how to transfer it...? is it really needed go via PHP ...? and ofcourse use innerHTML to write it....yes I usually use an intermitened processform.php script. http://developer.yahoo.com/yui/editor Hi all, I have a form which takes some values as input and stores them in a db for another use. I have the following java script to validate the entries. Code: <HTML><HEAD><TITLE>Electronic Deposting Form</TITLE> <script language="JavaScript"> <!-- script start function validateComplete(formObj) { if (emptyField(formObj.username)) alert("Please enter the Username."); else if (emptyField(formObj.passwd)) alert("Please enter the Password."); else if (emptyField(formObj.drop)) alert("Please enter the Drop Folder."); else return true; return false; } // Check to see if field is empty function emptyField(textObj) { if (textObj.value.length == 0) return true; for (var i=0; i<textObj.value.length; ++i) { var ch = textObj.value.charAt(i); if (ch != ' ' && ch != '\t') return false; } return true; } function chklen() { var un = document.getElementById("username").value var len = un.length; if (len > 15) { alert ("ERROR!!Only 15 characters are allowed in Username!!"); document.getElementById("username").value = un.substring(0,15); // remove excess characters } } // script end --> </script> Now I am planning to add a combo box to the form where I have the environment field. Following is the code for the form. Code: <td align="left" valign="top"><FORM name="form" action="../saveDP.cgi" method="post" onSubmit="return validateComplete(document.form)"><TABLE width="100%" cellPadding=2 cellSpacing=2> <TR> <TD width="26%" class="label"><B>Username </B></TD> <TD width="3%" class="label">:</TD> <TD width="71%"><INPUT maxLength=255 size=28 name=username id='username' onkeyup="chklen()"> <TR> <TD class="label" ><B>Password </B></TD> <TD class="label">:</TD> <TD><INPUT type=password maxLength=255 size=28 name=passwd> <TR> <TD class="label"><B> Environment </B></TD> <TD class="label">:</TD> <TD><SELECT class="input" size=1 name=environ> <OPTION value=us selected><b> US </b></OPTION> <OPTION value=uk><b> UK </b></OPTION> </SELECT> </TD> </TR> <TD colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="19%"> </td> <td width="9%"><INPUT type=submit value=Submit v:shapes="_x0000_s1034"> </td> <td width="8%"><input type=reset value=Clear v:shapes="_x0000_s1035\"></td> <td width="64%"> </td> </tr> </table></TD> </TR> As I am new to JS, can anybody help me to implement a combo box( ie first two options are US and UK and third one is a text box which i can enter any value, can't be left blank while submitting the form) with "Environment" field? Hey guys, I've never use JavaScript before so bare with me. But, I have a registration form, and I want to have a location field in it, and then a region field that changes depending on what the user set as their location. But, I cannot get it to work, and I have no idea of how to go about doing it. Here is the JavaScript I have been using so far: Code: function toggleTable(select) { if(select.value == "uk") { select.value = "uk"; document.getElementById("region2").style.visibility = "collapse"; document.getElementById("region1").style.visibility = "visible"; } else if(select.value == "usa") { select.value = "usa"; document.getElementById("region1").style.visibility = "collapse"; document.getElementById("region2").style.visibility = "visible"; } } and it does show the right region depending on what the user inputed, but when the page loads, all the fields show up until the user click on the location field, here is the code for that so you can test it out: Code: <tr><td>Location: </td><td><select name="location" onclick="toggleTable(this);"> <option value="none">Please Select One</option> <option value="uk">UK</option> <option value="usa">USA</option> </select></td></tr> <tr id="region1"><td>Region: </td><td> <select name="region"> <option value="uk1">uk1</option> <option value="uk2">uk2</option> </select></td></tr> <tr id="region2"><td>Region: </td><td> <select name="region"> <option value="usa1">usa1</option> <option value="usa2">usa2</option> </select> </td></tr> Any help at all please? i want to build a form have a "payment" select option ex. when user choose option "credit card" is will show some textbox(firstname and lastname,ccnumber,ccv,expday...) when user choose option "paypal" is will show some textbox(firsname,email paypal). Please help me solve this Wondering if anyone could point me in the right direction! I am trying to create a HTML form for a hire company that has multiple selection criterias i.e. mpg, passenger/seats, gearbox etc etc - based on these selections I need the form information to check against my JS object/array and find those objects which match the relevant attributes. The form itself has only radio buttons and one text field - I know how to take the data from an element of the form and put it into a variable so I can check it, but what I really want is to have all the information on the form matched against my object - Would I be looking at perhaps putting the form selections into a blank/new array and then comparing that to the object? If so any help/guidance would be greatly appreciated! Code: //array information */ var car=new Array("Lamborghini Aventador", "Peugeot 107", "VW Golf", "Toyota Prius", "Kia Sedona", "Citroen 2CV", "Vauxhall Insignia", "Mercedes C180", "Reliant Robin", "Ford Fiesta"); var mpg=new Array(13, 61, 47, 65, 32, 62, 40, 30, 70, 49); var passenger=new Array(2, 4, 5, 5, 7, 4, 5, 5, 2, 5); var luggage=new Array(0, 1, 2, 2, 4, 1, 3, 2, 1, 2); var fuel=new Array("Petrol", "Petrol", "Diesel", "Petrol", "Diesel", "Petrol", "Diesel", "Petrol", "Petrol", "Petrol"); var gearbox=new Array("Semi-Automatic", "Manual", "Manual", "Manual", "Manual", "Manual", "Automatic", "Automatic", "Manual", "Automatic"); var aircon=new Array("Yes", "No", "Yes", "Yes", "Yes", "No", "Yes", "Yes", "No", "Yes"); var daycost=new Array(2000, 30, 34, 44, 40, 25, 45, 87, 10, 31); var weekendcost=new Array(3800, 90, 97, 110, 99, 70, 115, 243, 25, 90); var weeklycost=new Array(12000, 135, 167, 183, 162, 124, 173, 560, 65, 130); var cars = {}; for(var i=0;i<car.length;i++) { cars[i] = { name: car[i], mpg: mpg[i], passenger: passenger[i], luggage: luggage[i], fuel: fuel[i], gearbox: gearbox[i], aircon: aircon[i], daycost: daycost[i], weekendcost: weekendcost[i], weeklycost: weeklycost[i] } } 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>Car Hires</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="array.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>Car Hires</a></h1> <form id="myform" class="appnitro" method="post" action=""> <div class="form_description"> <h2>Car Hires</h2> <p>Fill the form below, and we will provide you with a list of cars that match your requirements.</p> </div> <ul > <li id="li_1" > <label class="description" for="element_1">Name </label> <span> <input id="element_1_1" name= "fname" class="element text" maxlength="255" size="8" value=""/> <label>First</label> </span> <span> <input id="element_1_2" name= "element_1_2" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_2" > <label class="description" for="element_2">Email </label> <div> <input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li class="section_break"> <h3>Section Break</h3> <p></p> </li> <li id="li_4" > <label class="description" for="element_4">No. of Passengers </label> <div> <input id="element_4" name="passengers" class="element text small" type="text" maxlength="255" value=""/> </div><p class="guidelines" id="guide_4"><small>Enter the number of passengers in numerical format</small></p> </li> <li id="li_5" > <label class="description" for="element_5">Items of Luggage </label> <span> <input id="element_5_1" name="luggage" class="element radio" type="radio" value="1" /> <label class="choice" for="element_5_1">1</label> <input id="element_5_2" name="luggage" class="element radio" type="radio" value="2" /> <label class="choice" for="element_5_2">2</label> <input id="element_5_3" name="luggage" class="element radio" type="radio" value="3" /> <label class="choice" for="element_5_3">3</label> <input id="element_5_4" name="luggage" class="element radio" type="radio" value="4" /> <label class="choice" for="element_5_4">4</label> </span> </li> <li id="li_6" > <label class="description" for="element_6">Fuel Type </label> <span> <input id="element_6_1" name="fuel" class="element radio" type="radio" value="1" /> <label class="choice" for="element_6_1">Diesel</label> <input id="element_6_2" name="fuel" class="element radio" type="radio" value="2" /> <label class="choice" for="element_6_2">Petrol</label> </span> </li> <li id="li_7" > <label class="description" for="element_7">Transmission/Gear Box </label> <span> <input id="element_7_1" name="gearbox" class="element radio" type="radio" value="1" /> <label class="choice" for="element_7_1">Automatic</label> <input id="element_7_2" name="gearbox" class="element radio" type="radio" value="2" /> <label class="choice" for="element_7_2">Manual</label> </span> </li> <li id="li_8" > <label class="description" for="element_8">Airconditioning </label> <span> <input id="element_8_1" name="aircon" class="element radio" type="radio" value="1" /> <label class="choice" for="element_8_1">Yes</label> <input id="element_8_2" name="aircon" class="element radio" type="radio" value="2" /> <label class="choice" for="element_8_2">No</label> </span> </li> <li id="li_9" > <label class="description" for="element_5">Miles Per Gallon</label> <span> <input id="element_5_1" name="MPG" class="element radio" type="radio" value="1" /> <label class="choice" for="element_5_1">10-30</label> <input id="element_5_2" name="MPG" class="element radio" type="radio" value="2" /> <label class="choice" for="element_5_2">30-50</label> <input id="element_5_3" name="MPG" class="element radio" type="radio" value="3" /> <label class="choice" for="element_5_3">50-80</label> </span> </li> <li id="li_10" > <label class="description" for="element_9">Duration of Rental </label> <div> <select class="element select medium" id="element_9" name="element_9"> <option value="" selected="selected"></option> <option value="1" >Day</option> <option value="2" >Weekend</option> <option value="3" >Full Week</option> </select> </div> </li> <li class="buttons"> <input type="hidden" name="form_id" value="365314" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> <div id="footer"> Car Hire Form</a> </div> </div> <img id="bottom" src="bottom.png" alt=""> </body> </html> Hi, Posting this in javascript because the problem might be caused by my scripting. I made a 3 page long form using javascript, and the contents of the second page aren't submitted to the php script. link Hope someone can check it for errors. Thanks! How come this doesn't work? I take it because 'unchecked' is not valid? Code: if (document.forms["form"]["targetname"].value == "" && document.forms["form"]["unknownname"] == "unchecked") I have created a simple webpage that allows users to search multiple comparison shopping sites at once. This is just a side project that I am working on. At the current time, the webpage has the sites listed with checkboxes. The user can put in a search term in the box and then select which sites they want to search. The sites then open in a new window or on different tabs depending on which browser they are using. What I would like to do is find out if there is a way to have the same thing, but the sites open in the same window below the search box, like in tabbed frames. I tried doing something with the tabbed viewer script from dynamic drive: http://www.dynamicdrive.com/dynamici...bdocviewer.htm, but was unable to figure out how to get the search parameter into the url. My page can be found at http://www.imarkinteractive.com/tools/onesearch.html and all of the javascript is on the page. Does anyone know if this can be accomplished and if so, how would I go about doing it. I can run a php script on my server if that would be easier, but I would really appreciate the assistance. Thanks. Is it possible to use JavaScript to send a HTML FORM this way? (By the way, this is a huge guess - I don't know JavaScript very well) Code: <SCRIPT type="text/javascript"> function Cart1Function() { get.INPUT.quantity.value send.to.formsubmit1.php } function Cart2Function() { get.INPUT.quantity.value send.to.formsubmit2.php } </SCRIPT> <FORM action="?" method="post" name="form"> <DIV> <INPUT type="text" name="quanitity"> <INPUT type="submit" value="CART 1" onClick="Cart1Function"> <INPUT type="submit" value="CART 2" onClick="Cart2Function"> <DIV> </FORM> I want to make two forms sharing the same input (quantity). This is the weirdest thing I've come across in awhile. I have some code that formats a input field for a date format. This code runs fine on all browser when the form tag isn't wrapped around the inputs. The second I wrap the form tag around the inputs everything messes up. The Javascript error I'm getting is "Object doesn't support this property or method." on line 45 which is the line of the date input field. I'm totally clueless what I'm doing wrong here. And so I'll leave it up to you the wonderful community to give me some help. Thanks, Jon W Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html leng="en"> <head> <script type="text/javascript"> function dob(val,e) { if(e.keyCode != 8) { if(val.length == 2 || val.length == 5) { if(val.match(/[\/]$/) != "/") { document.getElementById('dob').value += "/"; } } var regex = /[a-zA-Z]|\+|\-|\&|\\|\(|\)|\%\|\$|\#|\@|\*|\_|\?|\>|\<|\,|\./; if(val.match(regex)) { newStr = val.replace(regex,''); document.getElementById('dob').value = newStr; } } } </script> <style type="text/css">@import url(/css/home.css);</style> </head> <body> <div id="wrapper"> <div id="header"> <div id="logo"><a href="/index.php"><img src="/images/logo.png" /></a></div> </div> <div id="container-arrow"></div> <div id="container"> <img src="/images/no_image.png" /> <div id="sign-container"> <span class="sign-header"> Sign Up </span> <div id="sign-arrow-up"></div> <div id="sign-content"> <form method="post" action="/account/index.php" name="sign"> <label for="email">Email</label><input name="email" class="sign-inputs" type="text" /> <p> </p> <label for="password">Password</label><input name="password" class="sign-inputs" type="password" /> <p> </p> <label for="dob">Date Of Birth</label> <input type="text" name="dob" style="text-align:center;" maxlength="10" class="sign-inputs" id="dob" value="MM/DD/YYY" onkeyup="dob(this.value,event);" onkeydown="dob(this.value,event);" onfocus="if(this.value=='MM/DD/YYY') this.value='';" title="MM/DD/YYY" /> <p> </p> <input name="submit" type="submit" class="sign-submit" value="Sign Up" /> </form> </div> </form> </div> </div> </div> </body> </html> This is what I'm trying to do. CONDITIONS: If a person selects a Friday Class but not a Saturday Class the Total Cost Field will automatically enter $99. If a person selects a Saturday Class but not a Friday Class the Total Cost Field will automatically enter $99 as well. If a person selects both a Friday & Saturday Class the Total Cost field will automatically be $159. I found the following code and so far only have it changing when a Friday class is entered. I have no idea where to go from here. Please help. 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" xml:lang="en" lang="en"> <head> <title>Test</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> </head> <body> <div> <p><span class="style1">Friday Class:</span> <select id="fridayClass" > <option> </option> <option value="Class1"> Class 1 </option> <option value="Class2"> Class 2</option> <option value="Class3"> Class 3 </option> </select> </p> <p> <span class="style1">Saturday Class:</span> <select id="saturdayClass" > <option> </option> <option value="Class1"> Class 1 </option> <option value="Class2"> Class 2</option> <option value="Class3"> Class 3 </option> </select> </p> </div> <div><span class="style1">Total Cost:</span> <input type="text" id="totalCost"/></div> <script> window.onload = function () { var friday = document.getElementById('fridayClass'), saturday = document.getElementById('saturdayClass'); friday.onchange = function () { totalCost.value = '$99.00'; }; }; </script> Hi, I'm working on a menu update form. I'm pulling the existing data from mysql and posting it into a form, using php. This works fine. But now I want the user to be able to modify the data and perform and update query to the database with the changes. I cannot figure out how to get the modified php text box data into my html form text boxes so I can run an update query. I would be ok with a button that transfers the php text box data to the html form data. Hope this is clear what I'm trying to do, seems simple enough, but I can't figure it out. Thanks in advance for any ideas. I am not familiar with javascript only html, but I have researched this problem and found some solutions, but I am unsure what to do with them. I have an html checkbox form that lists book titles. The user will click on the checkbox next to the titles that interest them. Then when they click submit, I want a pop-up box to appear with the titles they selected in a printable list. I found this javascript code: Code: <script langauge="javascript" type="text/javascript"> function openPreview() { var myWin = window.open ("popup.htm","myWindowName","width=500,height=350"); myWin.focus(); } </script> Then here is my html form code: Code: <form action="" form id= "myInput"> <table width="523"> <tr><td width="33"> <input type="checkbox" name="product" value="Ironman"></td> <td width="229"><div align="left">Ironman</div></td> <td width="174">Chris Crutcher </td> <td width="56" align="right"> </td></tr> <tr><td><input type="checkbox" name="product" value="Staying Fat for Sarah Byrnes"> <th><div align="left">Staying Fat for Sarah Byrnes </div></th> <td>Chris Crutcher </td> <td align="right"><tt>Realism</tt></td> </tr> <tr><td><input type="checkbox" name="product" value="The Watsons Go to Birmingham"> <th><div align="left">The Watsons Go to Birmingham </div></th> <td>Chrisopher Paul Curtis </td> <td align="right"> </td> </tr> </table> <input type="button" id="btnPreview" name="btnPreview" value="Preview" onclick="openPreview()" /> </form> Then on the popup.htm page I have this code Code: <script language="javascript" type="text/javascript"> document.write(window.opener.document.getElementById("myInput").value); </script> This code has worked for me when the form is a textarea or a label, but I don't know how to use it with a checkbox form. I know that labeling the form "my input" only works for textarea or labels, so I understand why the pop-up menu says undefined. What do I need to do to get the checkbox data to appear. Hello. I want to validate via javascript an input text box. What i want is to have at least two words ( not letters ). At this moment i did validation to detect if the input is empy: <script> function validateForm() { var x=document.forms["myForm"]["s"].value if (x==null || x=="") { alert("Nu ati introdus nimic."); return false; } } </script> But how to validate to have at leat two words inside my input area. Thank you. Here is my form: <form name="myForm" method="get" id="searchform" onsubmit="return validateForm()" action="<?php bloginfo('home'); ?>/"> <div><input type="text" value="" name="s" id="s" /> <input type="hidden" name="cat" value="19" /> <input type="submit" id="searchsubmit" value="Cauta document" /> </div> </form> HI I have set up a page passing information.. eg anything.htm?the text and I am trying to retrieve it into a form field ie pre fill a box. What I cant seem to work is to get the text after the ? into prefilled text for the field I can print it with document.write. I am trying to get it into (or something similar) <textarea rows="4" name="products" cols="49"> XXXX here text after htm? XXXX </textarea>. Hope this makes sense and I appreciate any help and time. Hi, I am trying to submit a form in javascript on clicking 'Button1'.On submission,it will disable the html table 'HTMLTable1' present in it.The code which I am using is as: Code: function OnButton1_Click ( ) { var oRows = document.getElementById('HTMLTable1').getElementsByTagName('tr'); var irows = oRows.length ; if (confirm("Are you sure you want Submit?")) { for(k=1; k<=irows; k++) { if(document.getElementById("list"+k).selectedIndex == 0) { document.getElementById("list"+k).selectedIndex = 1; document.getElementById("list"+k).options[1].style.backgroundColor = "green"; } } Saver(); document.getElementById("HTMLTable1").disabled = true; } else{ alert("Submit cancelled!"); } } But On submit,the html table is getting disabled just for a moment then again it becomes active and user can interact with it.Can anyone tell me where this code is misbehaving? Thanks, Anil Hi I am trying to write a simple script for html form validation before going on to write a more complicated script for the full form which will eventually be on the web page. However, I cannot tell if the javascript is executing or not, as no alert messages come up. If I fill in the form with blanks (which is what the function checkform() checks for) then it should display an alert on submission and return false. Otherwise, returns true. I need to get this licked before going on to the more complex coding, but I really can't see why this doesn't appear to work. I'd be most grateful if some kind soul out there could have a look at it for me.... Links below. Thank you in anticipation! http://www.kellyresources.co.uk/onli...ment_test.html http://www.kellyresources.co.uk/checkform.js CHANGE XX to TT CHANGE zero in c0m to O becoming com CHANGE YYY to WWW hxxps://yyy.yousendit.c0m/download/dklxb2VIcVg1aWF4dnc9PQ first an example of what im trying to do: when logging in to a forum, you enter your info at the top right corner. thts where the login info txt boxes are usually located. under these you'll find a menu bar. if you're logged in, the menu commands/items arent the same as when you're not logged in. example of logged in is search. example of not being logged in is register. anyways under the menu there's the forum itself. u no, sections and topics. the table basically. this is wht im trying to do. even if im doing it wrong plz indulge me I know that ppl dont use frames much anymore. but just go with it. It DOES help to no how to do something in different ways. Ok, assuming you setup my pages, press submit. All 3 frames SHOULD go to 1.php BUT what happens is that the lower two frames go to 1.php. the first frame doesnt. It's the frame that has the form which has the button. If i put the button outside the form and press submit, it works. all 3 frames change. so i'm guessing it's got to do with the form itself. How do I fix it? Thank you!!!! |