JavaScript - Passing A Value From One Page To A Text Box On Another
Good Morning all
I have a code that worked and i messed something up trying to add on to it and i cant figure out what i did I have a form for gift certificates (giftcerticate.html)user enters to: amount: from: then can choose a gift card to include with it. to do so they click a link that sends them to another page (giftcards.html) with a group of radio buttons. they choose a radio button where the result is to be sent back to the first page (giftcerticate.html) and place the result in a text box with a sample of the giftcard image. My issue is that when i go back to the first page it does not pass any of the values to the textboxes. it does show the the text box id's in the URL but no values or place them in the boxes. here is what it sends in the url: http://www.allyscandle.com/index/GIF....html?product1[]2=&product1[]=&price1=&giftcardstocknumber=BBA+-+003&submit=CARD+STYLE+CHOOSEN here is the script: <script type="text/javascript"> function getURI(string,parm) { var url = location.href; // Get the current URL var gsn = (location.href.split('giftcardstocknumber=')[1].split('&')[0]).replace(/\+/g,' '); var img = (location.href.split('img=')[1]).replace(/\+/g,' '); document.getElementById('gsn').value = gsn; document.getElementById('gsn-img').src = 'GIFTCARDS/'+img; } window.addEventListener?window.addEventListener('load',getURI,false):window.attachEvent('onload',get URI); </script> here are the two forms http://www.allyscandle.com/index/GIFTCERTIFICATES.html http://www.allyscandle.com/index/GIFTCARDS.html any help would be great i have been at this for a week now Similar TutorialsHello, I am having some issues passing information to a text box in a form. Basically, right now, when a date on the calendar is selected, the date is printed in the <div id="date"> field. however i want to put this value in the form text box instead. I've tried document.getElementsByName('date') or getElementById('date') and get either a "Object HTMLDivElement" or "Object NodeName" in the text box. Here is the relevant code... I hope Code: <script type="text/javascript" src="javascripts/prototype.js"></script> <script type="text/javascript" src="javascripts/calendarview.js"></script> <script type="text/javascript"> window.onload = function() { Calendar.setup({ dateField : 'date', parentElement : 'calendar' }) } function writeme(){ document.form1.datebox.value = document.getElementsByName('date').value; } </script> </head> <body style="font-family: calibri;"> <div id="calendar" style="margin: 60px;" onmouseup="writeme()"></div> <div id="date" name="date">Select Date</div> <form name="form1"> <input type="text" name="datebox" id="datebox" size="12" value="" /> <input type="button" name="testbtn" value="test me" /> </form> I am just starting to learn javascript and was hoping someone might be able to answer my question: var months = "April Showers"; document.write('<p><img src="ad11.jpg"); document.write(" alt="); document.write(months); document.write(">"); document.write(months); How come when I display my output to a browser without the presence of the ad11.jpg file, only the first word (April) in the text string "April Showers" is dispayed where the .jpg file is suppose to be...but the last line displays the entire text string. I want to pass 2 variables from a html page and collecting in another html page using javascript. say i pass xyz and abc to a page 2.html from 1.html without using cookies. In 1.html page i have many links. each link should be able to pass different variable to 2.html. when some one clicks on a link the variables should be passed to 2.html I want to know how to collect them and use them. please provide me code snippet. hello guys the idea is to make "offline" bill of lading i used to do php thing and well this time i only need to kinda make bill of lading generator so i want to pass value from page 1 to page 2 and to page . all offline without web server interaction i was never fluent in javascript and i wanted to get a quick start from you guys how do i pass the form ( javascript variable from 1 page to another page ) i am googling this as well right now and hoping answer from codingforums thanks Hi guys, how do I use a query string to pass a image that a user selects from a number of images to a second page where the selected images will be displayed as a slideshow? Thanks all
I'm fairly new at this. I'm trying to build a store locator and trying to figure out how to pass an input value from one page to another page. User would input their zipcode or address in a form on one page and the map and locations would be called on another page using the input. I'm using ehound store locator platform (sample - here -> http://www.ehoundplatform.com/api/1....nd-google.html) The map/locator script is this Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Store Locator Demo using FreeHound and Google Maps V.3</title> <style type="text/css"> #map_canvas { height: 400px; width:710px; margin-bottom: 10px; } .addressBox { margin-bottom:10px; } </style> <script type="text/javascript" src="http://www.ehoundplatform.com/api/1.0/proximity.js?key=xz396aw1qe432q1"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false®ion=AU"></script> <script type="text/javascript"> var geocoder; var map; var bounds; var markersArray = []; var infoWindow; var mapCenterLat = '-28.1594'; var mapCenterLon = '135.6456'; function initialize() { geocoder = new google.maps.Geocoder(); var myOptions = { zoom: 4, center: new google.maps.LatLng(mapCenterLat, mapCenterLon), mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); //initialise single info window to show only one at a time infoWindow = new google.maps.InfoWindow(); //improve usability by centering map around search point on zoom in/out google.maps.event.addListener(map, 'zoom_changed', function() { if(mapCenterLat && mapCenterLon) { setTimeout('centerMap(mapCenterLat, mapCenterLon)', 300); } }); } function addMarkerOverlay(location, title, infoBox, image) { var marker = new google.maps.Marker({ position: location, map: map, icon: image }); marker.setTitle(title); google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(infoBox); infoWindow.open(map, marker); }); markersArray.push(marker); } function deleteOverlays() { if (markersArray) { for (i in markersArray) { markersArray[i].setMap(null); } markersArray.length = 0; } } function searchAroundMe() { deleteOverlays(); bounds = new google.maps.LatLngBounds(); var address = document.getElementById("address").value; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); //custom marker to mark initial search location var image = new google.maps.MarkerImage('search_location.png', // This marker is 32 pixels wide by 32 pixels tall. new google.maps.Size(32, 32), // The origin for this image is 0,0. new google.maps.Point(0,0), // The anchor for this image is the center of the red circle at 16,16. new google.maps.Point(16, 16) ); addMarkerOverlay(results[0].geometry.location, 'search spot', 'search initiated from here', image); bounds.extend(results[0].geometry.location); var searchLatitude = results[0].geometry.location.lat(); var searchLongitude = results[0].geometry.location.lng(); mapCenterLat = searchLatitude; mapCenterLon = searchLongitude; freeHound = new FreeHound( 'showLocs' ); search = new FH_Search(); search.count = 10; //number of locations to be returned in the result set search.max_distance = 0; //distance limit for proximity search in km, 0 for unlimited //search from a specific point using latitude and longitude of that point search.point = new FH_Location( new FH_LatLon( searchLatitude,searchLongitude ) ); //search.filters = new Array(); //search.filters.push( new FH_SearchFilter('cat_id', 'eq', '177') ); search.create_log = false; freeHound.proximitySearch( search ); } else { alert("Geocode was not successful for the following reason: " + status); } }); } function showLocs(response){ if ( response.error_code ) { alert(response.error_message); } if ( response.record_set ) { //show results in a table var resultsTable = '<table border="1" cellspacing="0" cellpadding="3" summary="">'; resultsTable += '<tr>'; resultsTable += '<td>#<\/td>'; resultsTable += '<td>Street Address<\/td>'; resultsTable += '<td>Town/Suburb/City<\/td>'; resultsTable += '<td>Postal Code<\/td>'; resultsTable += '<td>State/Province<\/td>'; resultsTable += '<td>Distance<\/td>'; resultsTable += '<td>Longitude<\/td>'; resultsTable += '<td>Latitude<\/td>'; resultsTable += '<\/tr>'; for (var record_count = 0, rl = response.record_set.length; record_count < rl; record_count++ ) { var record = response.record_set[record_count]; var title = record.details.location_name; var infoBoxContent = '<strong>Location #'+(record_count+1).toString()+'<\/strong>'; infoBoxContent += '<br \/>'+record.address.street_address+'<br \/>'+record.address.town + ', ' + record.address.postal_code +'<br \/>'; infoBoxContent += 'Distance: '+record.distance.km+'km<br \/>'; addMarkerOverlay(new google.maps.LatLng(record.latitude, record.longitude), title, infoBoxContent, null); if (record_count < 6) { bounds.extend(new google.maps.LatLng(record.latitude, record.longitude)); } resultsTable += '<tr>'; resultsTable += '<td>'+(record_count+1).toString()+'<\/td>'; resultsTable += '<td>'+record.address.street_address+'<\/td>'; resultsTable += '<td>'+record.address.town+'<\/td>'; resultsTable += '<td>'+record.address.postal_code+'<\/td>'; resultsTable += '<td>'+record.address.state+'<\/td>'; resultsTable += '<td>'+record.distance.km+'KM<\/td>'; resultsTable += '<td>'+record.longitude+'<\/td>'; resultsTable += '<td>'+record.latitude+'<\/td>'; resultsTable += '<\/tr>'; } map.fitBounds(bounds); resultsTable += '<\/table>'; var resultSet = document.getElementById('resultSet'); resultSet.innerHTML = resultsTable; } } function centerMap(lat,lon) { var centrePoint = new google.maps.LatLng(lat,lon); map.setCenter(centrePoint); } </script> </head> <body onload="initialize()"> <div class="addressBox"> <form action="" onsubmit="searchAroundMe(); return false;"> <input id="address" type="textbox" value=""> <input type="submit" name="search" value="Address Search"> </form> </div> <div id="map_canvas"></div> <div id="resultSet"></div> </body> </html> and the form itself would be on another page. Trying to pull the address input over. This obviously doesn't work 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>Store Locator</title> </head> <body> <div> <form action="ehound.html" method="post"> <input id="address" name="address" type="textbox"> <input type="submit" name="search" value="Address Search"> </form> </div> </body> </html> I've looked around on passing inputs via php and such, but this script seems to call on javascript as well and I'm having trouble implementing anything that works. Any help would be greatly appreciated. Hello, I use a iplocator api, which is javascript and gives out the city name, country and zipcode output PHP Code: <script language="JavaScript" src="http://www.somesite.com/somefile.js?key=apikey"></script> <script language="JavaScript"> <!-- document.write(ip2location_isp() + ', ' + ip2location_city() + ', ' + ip2location_zip_code() + ', ' + ip2location_net_speed()); //--> </script> my question or where i need help is that, i would like to output each of those as a hidden text field, so later i can store into mysq database with POST method from the hidden field. thank you in advance for your time n help I'm new to javascript and have come across what I'm sure its a really easy problem to solve. I want a page with a hyperlink that passes a variable to another 'pop-up' page (in this case a name, its just an example) and new pop-up page prints a message followed by the variable thats passed. Here is the code as it is right now Code: <html> <head> <script language="javascript" type="text/javascript"> function popitup(a) { var reply = 'a'; newwindow=window.open('','name','height=200,width=150'); var tmp = newwindow.document; tmp.write('<html><head><title>popup</title>'); tmp.write('</head><body><p>"Hello there" + reply </p>'); tmp.write('<p><a href="javascript:self.close()">close</a> the popup.</p>'); tmp.write('</body></html>'); tmp.close(); } </script> </head> <body> <a href="testpopup.html" onclick="popitup('Toby')" >Link to popup</a> </body> </html> In short, I just want the pop-up page to print 'Hello there Toby' or whatever name I choose to pass across. Any help much appreciated!! The 'testpopup.html' url is just the initial webpage. Hi all: This script and code works great, but in order for me to finish, I need a way of passing to the next PHP page which check box is checked. Currently, it is just passing a single value (1, 2, 3, 4, 5, or 6) depending on the last box checked. I need a way to record which check boxes are selected. Code: <html> <head> <script type="text/javascript"> var majors = { "001 - Exchange" : [ 2, 6 ], "003 - Academic Foundations" : [ 2, 6 ], "005 - Pre-Engineering" : [ 2, 6 ], "006 - Pre-Business" : [ 2, 6 ], "008 - Pre-Nursing" : [ 2, 6 ], "010 - Accounting" : [ 3, 4 ], "014 - Afro-American Studies" : [ 2, 6 ], "050 - American Studies" : [ 2, 6 ], "070 - Anthropology" : [ 2, 6 ], "080 - Art" : [ 2, 6 ], "082 - Art History" : [ 2, 6 ], "090 - Arts and Sciences" : [ 2, 6 ], "100 - Astronomy" : [ 2, 6 ], "115 - Biochemistry" : [ 2, 6 ], "120 - Biology" : [ 2, 5, 6 ], "124 - Biomedical Technology" : [ 2, 6 ], "130 - Botany" : [ 2, 6 ], "135 - Business Administration" : [ 3, 4 ], "140 - Business Law" : [ 3, 4 ], "160 - Chemistry" : [ 2, 5, 6 ], "163 - Childhood Studies" : [ 2, 5, 6 ], "190 - Classics" : [ 2, 6 ], "198 - Computer Science" : [ 2, 5, 6 ], "200 - Creative Writing" : [ 5 ], "202 - Criminal Justice" : [ 2, 5, 6 ], "203 - Dance" : [ 2, 6 ], "220 - Economics" : [ 2, 6 ], "300 - Education" : [ 2, 6 ], "350 - English" : [ 2, 5, 6 ], "352 - English - American Literature" : [ 2, 5, 6 ], "354 - English - Film Studies" : [ 2, 5, 6 ], "360 - European Studies" : [ 2, 6 ], "387 - Film Studies" : [ 2, 6 ], "390 - Finance" : [ 3, 4 ], "415 - Foreign Languages" : [ 2, 6 ], "420 - French" : [ 2, 6 ], "460 - Geological Sciences" : [ 2, 6 ], "470 - German" : [ 2, 6 ], "490 - Greek" : [ 2, 6 ], "500 - Hebraic Studies" : [ 2, 6 ], "509 - Historical Methods and Skills" : [ 2, 6 ], "510 - History, General" : [ 2, 6 ], "512 - History, American" : [ 2, 5, 6 ], "516 - African Asian Latin American and World Hist" : [ 2, 6 ], "520 - Home Economics" : [ 2, 6 ], "525 - Honors Program" : [ 2, 6 ], "533 - Human Resource Development" : [ 3 ], "537 - Hospitality Management" : [ 3 ], "549 - International Studies" : [ 2, 6 ], "555 - Student Proposed Major" : [ 2, 6 ], "560 - Italian" : [ 2, 6 ], "565 - Japanese" : [ 2, 6 ], "570 - Journalism" : [ 2, 6 ], "580 - Latin" : [ 2, 6 ], "590 - Latin American Studies" : [ 2, 6 ], "601 - Law - Day Student" : [ 1 ], "602 - Law - Evening Student" : [ 1 ], "606 - Liberal Studies" : [ 2, 5, 6 ], "615 - Linguistics" : [ 2, 5, 6 ], "620 - Management" : [ 3, 4 ], "623 - Management Science and Info Systems" : [ 3, 4 ], "626 - Managerial Economics" : [ 4 ], "630 - Marketing" : [ 3, 4 ], "640 - Mathematics" : [ 2, 6 ], "645 - Mathematical Science" : [ 5 ], "660 - Medical Technology" : [ 2, 6 ], "680 - Microbiology" : [ 2, 6 ], "698 - Museum Studies" : [ 2, 6 ], "700 - Music" : [ 2, 6 ], "701 - Music, Applied" : [ 2, 6 ], "705 - Nursing" : [ 2, 6 ], "730 - Philosophy" : [ 2, 6 ], "740 - Physical Education" : [ 2, 6 ], "742 - Physical Therapy" : [ 5 ], "750 - Physics" : [ 2, 6 ], "760 - Physiology" : [ 2, 6 ], "780 - Plant Physiology" : [ 2, 6 ], "790 - Political Science" : [ 2, 6 ], "830 - Psychology" : [ 2, 5, 6 ], "834 - Public Administration" : [ 5 ], "840 - Religon" : [ 2, 6 ], "842 - Rhetoric" : [ 5 ], "860 - Russian" : [ 2, 6 ], "890 - General Science" : [ 2, 6 ], "910 - Social Work" : [ 2, 6 ], "920 - Sociology" : [ 2, 6 ], "940 - Spanish" : [ 2, 6 ], "950 - Speech" : [ 2, 6 ], "960 - Statistics" : [ 2, 6 ], "964 - Teacher Preparation" : [ 2, 6 ], "965 - Theater Arts" : [ 2, 6 ], "975 - Urban Studies and Community Development" : [ 2, 6 ], "976 - Urban Planning" : [ 2, 6 ], "981 - Volunteer Organization and Leadership" : [ 2, 6 ], "988 - Womens & Gender Studies" : [ 2, 6 ], "989 - Writing" : [ 2, 6 ], "990 - Zoology" : [ 2, 6 ] }; Array.prototype.isMember = function( find ) { for ( var i = 0; i < this.length; ++i ) { if ( this[i] == find ) return true; } return false; } function resetOptions( ) { var form = document.theForm; var sel = form.Majors; for ( var s = sel.options.length-1; s > 0; --s ) { sel.options[s] = null; } var checked = [ ]; for ( var cb = 0; cb < form.schools.length; ++cb ) { if ( form.schools[cb].checked ) checked.push( form.schools[cb].value ); } for( major in majors ) { var mschools = majors[major]; for ( var c = 0; c < checked.length; ++c ) { if ( mschools.isMember( checked[c] ) ) { sel.options[sel.options.length] = new Option( major, major ); break; } } } } </script> </head> <title>Search</title> <body bgcolor="99CCFF"> <center> <br> <center>Search:<table border='1'> <form name='theForm' action='display.php' method='post'> <tr><td>ID: </td><td><input type="text" name="ID"/></td></tr> <tr><td>Last Name: </td><td><input type="text" name="NAME_LAST"/></td></tr> <tr><td>First Name: </td><td><input type="text" name="NAME_FIRST"/></td></tr> <tr><td valign="top">School: </td> <td> <input type="checkbox" name="schools" value="1" onClick="resetOptions()"> Law School<br/> <input type="checkbox" name="schools" value="2" onClick="resetOptions()"> College of Arts and Sciences<br/> <input type="checkbox" name="schools" value="3" onClick="resetOptions()"> School of Business (Undergraduate)<br/> <input type="checkbox" name="schools" value="4" onClick="resetOptions()"> School of Business (Graduate)<br/> <input type="checkbox" name="schools" value="5" onClick="resetOptions()"> Graduate School<br/> <input type="checkbox" name="schools" value="6" onClick="resetOptions()"> University College </td> </tr> <tr><td>Major: </td><td><select name="Majors"> <option value="" selected>Select a major</option> </select></td></tr> <tr><td>Order By: </td><td> <select name="ORDER_BY"> <option value = "" selected> Select One </option> <option name="NAME_LAST" value = "NAME_LAST ASC"> Last Name </option> <option name="CURRIC_CD" value = "CURRIC_CD ASC"> Major </option> <option name="ID" value = "ID ASC"> RUID </option> <option name="UNIT_OF_REG_CD" value = "UNIT_OF_REG_CD ASC"> School </option> <option name="EMAIL_ADDR" value = "EMAIL_ADDR ASC"> Email Address </option> </select></td> </tr> </table> <br><br> <input type='submit'/> </form><br><br> </center> </body> </html> Thanks in advance. I am passing parameters from one page (actually from a frame within a frameset) to another using Javascript. Typically the code is as follows, taking values from a Form. Code: parent.titleFrame.location="frm_right_demo_title.html?MyDateEvent.value='"+ytt+ "'&MyParam_spec.value='"+parent.mainFrame.document.forms.myForm.MyParam_spec.value+"'"; This has worked fine in all browsers including IE, Chrome and Firefox version 2.0.0.2. However, I have now found that it doesn't work with Firefox version 3.6.12. This is because when retrieving the parameters in the new loaded page, the character ' (quote) has been converted to %27 (percent twenty seven). I can write code to replace %27 with the quote character. However, this is lengthy and time-consuming (as I need to have cyclic code as the javascript replace command seems to work only on the first occurrence within a string). Can someone please help me to understand why this is happening and how to overcome it? hi there, i'm new here and pretty new to js. i'm making a page for my daughter's school - or trying to. they are having a silent auction and i'm trying to make a very simple bidding page. where i'm running into problems is passing the bid to a text box (read only) where it can be updated when a new bid is entered. I would like this to be in the upper part of the page with the listings of the auction items, i just can't wrap my head around how to do this. I've gotten as far as the form for entering the bod and contact info. I have the php code to submit. i still have to get the validation js to make it more secure. thanks for any help. Code: <html> <body> <h1 id="logo"></h1> <div id="main"> <p> <h4>Silent Auction</h4> <form name="auction" method="post" action="send_form_email.php" > <label for="item1">Item 1</label> <br /> <label for="curr_bid_item_1">Current Bid = </label><br /> Your Bid = <input type="text" name="item1" maxlength="15" size="10" /> <br /> <br /> <label for="item2">Item 2</label><br /> <label for="curr_bid_item_2">Current Bid = </label><br /> Your Bid = <input type="text" name="item2" maxlength=="15" size="10" /> <br /> <br /> <label for="item3">Item 3</label><br /> <label for="curr_bid_item_3">Current Bid = </label><br /> Your Bid = <input type="text" name="item3" maxlength="15" size="10" /> <br /> <br /><br /><br /> <form name="contactform" method="post" action="send_form_email.php" onsubmit="document.getElementById('myButton').disabled=true; document.getElementById('myButton').value='Submitting, please wait...';"> <label for="first_name">First Name *</label> <input type="text" name="first_name" maxlength="50" size="30"><br /><br /> <label for="last_name">Last Name *</label> <input type="text" name="last_name" maxlength="50" size="30"><br /><br /> <label for="email">Email Address *</label> <input type="text" name="email" maxlength="80" size="30"><br /><br /> <label for="telephone">Telephone Number</label> <input type="text" name="telephone" maxlength="30" size="30"><br /><br /> <label for="comments">Comments</label><br /> <textarea name="comments" maxlength="1000" cols="40" rows="6"></textarea><br /><br /> <input type="submit" value="Submit" id="myButton" /> </form> </form> </div> </body> </html> Hi, I am trying to pass a video id value from one javascript page to another, extract the video id, append it to a utube url and then pass it to a html page for immediate display. I have managed to extract the video id value and append it to the url but cannot get it into the html section of the code. My code is posted below <html> <head> <script type="text/javascript"> function getParams() { var idx = document.URL.indexOf('?'); var urlId; var params = new Array(); if (idx != -1) { var url = document.URL.substring(idx+1, document.URL.length).split('&'); for (var i=0; i<url.length; i++) { videoVal = url[i].split('='); urlId = "http://www.youtube.com/v/" + videoVal[1]; } } document.getrElementById('UrlId').value=urlId; } params = getParams(); </script> </head> <body> <object width="425" height="344"> <param name="UrlId" value=urlId; </param><embed src=urlId type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"> </embed> </object> </p> </body> </html> I need to get it to appear as a complete url in the following lines in the html code <param name="UrlId" value=urlId; <embed src=urlId type="application/x-shockwave-flash"></embed> Can someone please help with this. Thanks I have a "pre-order" opt-in page disguised as a "step 1" in the order process of a clickbank product I'm ready to launch. I'm wanting to pass the user's first name, last name, and email address (built into the optin form) over to the clickbank order page upon submit. Clickbank gives me the data strings you can pass along, but I'm not sure how to properly configure this function or where to place it in my page code. This is the only step I have remaining before I can go live, and it's holding me back. Any suggestions would be extremely helpful. I can provide any code needed for review to assist in getting this wrapped up. Thanks in advance Hi there, I have a problem that I've been scouring the internet for an answer but have been unable to find a solution and wondered if anyone could offer their assistance here? I'll try to explain my problem: On my homepage (index.html), I have a search field which fires the users input (text) parameters off to another website to perform the search (ie. results.html). What I'm now trying to do is create an iframe on index.html which shows the search results on the same page (without the user having to visit the other website. Does anyone know if this is possible using javascript? The reason behind this is so that we can use the search on our old website on our new one... without having to re-invent the wheel. Any help would be greatly appreciated! Craig Hey guys, I've been searching for a few hours and haven't been able to find a code snippet to see if this is available. I'm attempting to pass text from my website to another website that has a form setup on it. I'd like to fill in the pertinent data for my users on the page that I load for them. I cannot make any changes to the receiving page as it is run by another company. I've pasted some of the code that is available on the receiving form. Thanks for any help. Code: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> <input name="txtBranch" type="text" maxlength="4" id="txtBranch" tabindex="1" style="height:14px;width:35px;" /> <input name="txtClient" type="text" maxlength="11" size="11" id="txtClient" tabindex="2" style="height:14px;" /> Im trying to fill in the data in these 2 input fields. Hi all, Thanks for reading. I'm having an issue trying to accomplish the following - I have a text field (field1) already displayed on the HTML page. However, there's a link where you can add additional text fields to the page as well. When the link is clicked, the second text field is added successfully (field2), and when the link is clicked again, the third text field (field3) is added successfully. However, the third field does not add itself to the page, and the text for anything greater than a third field also isn't displayed after. This obviously means that my "fields" variable is not working right, so I'm wondering, would anyone be able to assist me to help me get that variable processing correctly? Code: <script language="javascript"> fields = 1; function addMore() { if (fields = 1) { document.getElementById('addedMore').innerHTML = "<input type='text' name='field2' size='25' /> <span>Field 2.</span>"; fields = 2; } else if (fields = 2) { document.getElementById('addedMore').innerHTML = "<input type='text' name='field3' size='25' /> <span>Field 3.</span>"; fields = 3; } else { document.getElementById('addedMore').innerHTML = "Only 3 fields are allowed."; document.form.add.disabled=true; } } </script> Here is the code in my HTML - Code: <input type="text" name="field1" size="25" /> <span>Field 1.</span> <div id="addedMore"></div> <p class="addMore"><form name="add"><a onclick="addMore()">Add another field.</a></form></p> Thank you very much. Hello, i'm working on a 3 page survey. When hitting next, previous, or submit it passes the values of all the questions to the next page. I've got the whole thing working correcting except for one thing: When the box is "not" checked it passes no value. I'm needing it to have a value of "1" when checked and a value of "0" when not checked, and currently when its not checked and i pass the info it leaves it blank. I'd post the whole code to one of the pages but it's long , so i'll post the snipits of the code. Code: <script type="text/javascript"> /* <![CDATA[ */ function processQueryString() { var formData = location.search; formData = formData.substring(1, formData.length); while (formData.indexOf("+") != -1) { formData = formData.replace("+", " "); } formData = unescape(formData); var formArray = formData.split("&"); for (var i=0; i < formArray.length; ++i) { //document.writeln(formArray[i] + "<br />"); var sDataName = formArray[i].split("=") switch (sDataName[0]) { case ".lib_use": for (var j=0; j < document.getElementsByName(".lib_use").length; ++j) { if (document.getElementsByName(".lib_use").item(j).value == sDataName[1]) { document.getElementsByName(".lib_use").item(j).checked = true; //alert("lib_use set"); } } break; case ".lib_comp": if (sDataName[1] == 1) { document.getElementsByName(".lib_comp").checked = true; document.getElementsByName(".lib_comp").value= 1; } else { document.getElementsByName(".lib_comp").checked = false; document.getElementsByName(".lib_comp").value= 0; } break; default: alert("not caught = " + sDataName[0]); continue; } } } /* ]]> */ </script> <input type="checkbox" name=".lib_comp" id="lib_comp" value="1" /> The first case that i showed in my code is a radio button, and it passes correctly, i just wanted to show the "format" i was using in a working sense. The 2nd case is an example of the check boxes. Thanks for looking at this, and giving any suggestions you might have! Dear all, I'm passing the variables myTitle and myLink to form.php using javascript. This is the way I'm doing it: Code: <a href='form.php?title=" + myTitle +"&link="+myLink+">Click me</a> It's working great but sometimes myTitle and myLink contain the plus character (+). When this happens it's not passed. In the case of the title, it's just a problem of looks but in the case of the link, well, the link won't work without the character. As an example if the title is: Laptop + Accessories What is passed is: Laptop Accessories What can I do to pass also the plus character?? Thanks a lot!! Hi, I have what I assume started as a simple error and then trying to fix it I think I have made things so complicated I've become confused. I have two fields, a drop down list and a text field, when someone clicks on a value in a drop down list (I will show the results eventually but at the moment) I just want the result to echo in my getCategory.php and the same for the text field. Both php pages are currently being called. And at the moment contain $_REQUEST['category'] and $_REQUEST['ProductName'] respectively. Nothing is being echoed. I know the below code is wrong, but the more I try to correct it the worse it gets so I thought I would just leave it as is before I made it worse. Code: <script type="text/javascript"> function loadXMLDoc1(File,ID,Msg){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(ID).innerHTML=xmlhttp.responseText; } } var params=Msg; xmlhttp.open("POST",File,true); xmlhttp.setRequestHeader("Pragma", "Cache-Control:no-cache"); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", params.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(params); } </script> </head> <body> <label>Search by Category: </label> <select name="category" id="category" onchange='loadXMLDoc1("getCategory.php","txtHint","category")' class="input"> <option value="please select" selected"selected">Please Select</option> <option value="Clothes" name="Clothes" id="Clothes">Clothes</option> <option value="Bags" name="Bags" id="Bags">Bags</option> <option value="Hats" name="Hats" id="Hats">Hats</option> </select> <br /> <br /> <label>Search by name: </label> <input type="text" class="input" name="ProductName" id="ProductName" value="Search" size="30"/> <input type="button" value="Search" onclick="loadXMLDoc1('getProductName.php','txtHint', ProductName='(this.value)')" /> <br /> <br /> <div id="txtHint"></div> How do I make it so that typing into a text box and hitting a button will take me to a different page and populate a text box on that page with the text from the previous page?
|