Jump to content

jonathanbee

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jonathanbee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. well, I changed the textbox to a textarea and it works in Safari. I'd prefer not to use a textarea though...
  2. Thanks rajivgonsalves, but Safari does nothing still, works in IE and FF.
  3. That code works in all browsers, the static value gets inserted.
  4. Hi again rajivgonsalves, Sorry, to drag this on and on.. but there is no change, IE and FF work, but Safari does nothing. btw: I am testing this on both Mac and PC Safari 3.
  5. Hi again rajivgonsalves, There is no change, IE and FF work, but Safari does nothing.
  6. Hi rajivgonsalves, I have already tried using innerHTML, like so: var xxx = ajaxRequest.responseText; document.getElementById("xyz").innerHTML ="<input type='text' name='shippingAddress' id='shippingAddress' value='"+xxx+"' size='20'>"; the form code: <div id="xyx"><input type="text" name="shippingAddress" id="shippingAddress" size="20"></div> but it still doesn't populate the value field in Safari, note that this code works in IE and FF fine. I'm starting to think the textbox value cannot be updated in Safari..
  7. Hi mainewoods, Thanks, I removed all of those closing tags. I'm using an HTML doctype. I only tried this as a test; <input type="text" name="shippingAddress2" id="shippingAddress2" size="20"><div id="shippingAddress"></div></input> I did change the ID's so as not to duplicate them on the page... still not working though.
  8. Hi again mainewoods, Yes, the alert shows the correct data in Safari. I tried your suggestion about moving the code position, but the problem persisted. The original form input looks like this: <input type="text" name="shippingAddress" id="shippingAddress" size="20"></input> As a test, if I change it to this: <input type="text" name="shippingAddress2" id="shippingAddress2" size="20"><div id="shippingAddress"></div></input> and then use this code in the script: document.getElementById("shippingAddress").innerHTML = ajaxRequest.responseText;} I get the correct data appearing on the page... but I just cant get it to insert into the text box...
  9. Hi mainewoods, shippingAddress is a text box. the ajax is returning just text. While Safari is going and getting the correct data from my db, it's just not inserting it into that field I want, perhaps this has to do with how I am setting this function up? <script language="javascript" type="text/javascript"> <!-- // AJAX Browser Support Code function ajaxFunction(button){ var ajaxRequest; ajaxRequest = false; if(window.XMLHttpRequest && !(window.ActiveXObject)) { try { ajaxRequest = new XMLHttpRequest(); } catch(e) { //ajaxRequest = false; } // branch for IE/Windows ActiveX version } else if(window.ActiveXObject) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { //ajaxRequest = false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ if (button == "a"){ document.checkout.shippingAddress.value = ajaxRequest.responseText;} else if (button == "b") { document.checkout.billingAddress.value = ajaxRequest.responseText;} } } // Take shippingPostcode OR billingPostcode and send it to the PHP file if (button == "a"){ var pc = document.getElementById('shippingPostcode').value;} else if (button == "b") { var pc = document.getElementById('billingPostcode').value;} var queryString = "?pc=" + pc; ajaxRequest.open("GET", "/includes/pc_query.php" + queryString, true); ajaxRequest.send(""); } //--> </script>
  10. anyone? Surely someone must know why the alert would work, but the following line does nothing.. also, the safari debug js console shows no errors.. really stumped here.
  11. Hello, this code works it IE and FF, but for Safari it does nothing. Please can someone tell me what I am doing wrong here; alert (ajaxRequest.responseText); // indicates expected value in all browsers document.checkout.shippingAddress.value = ajaxRequest.responseText;} Thanks, Jonathan
  12. I figured out how to use AJAX to query the db while the user is filling out the form
  13. If I declare this at the start: $ney = $_SERVER['PHP_SELF']; And change the form action to: <form action="<?php echo $ney?>" method="GET"> then change the else to: else if ($_GET['redirect']) { $ney = "invoice.php"; it almost works.. am I on the right track or is this totally wrong?
  14. Thanks for your reply, so... I *must* use 2 forms to accomplish this? The 1st form's action would run the function that queries the db for the address based on the postal code, the 2nd form's action would advance to the next page. But, then is there some way for me to get data from both forms if the user clicks the 2nd button?
  15. sorry, I'm sure this code is not that good, I'm still learning :-\ : <?php // check which button was clicked if ($_GET['lookup']) { $new_code = $_GET['code']; $new_telephone = $_GET['telephone']; $c_new_code = mysql_real_escape_string($new_code); $d_new_code = ereg_replace ('[^0-9]+', '',$c_new_code); $query="select * from postal_codes where code='$d_new_code'"; $result=mysql_query($query); while($row = mysql_fetch_array($result)){ $addy1 = $row['add1']; $addy2 = $row['add2']; $addy3 = $row['add3']; $faddy = "{$addy1}{$addy2}{$addy3}"; } } else { } ?> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET"> <fieldset> <label>郵便場号:</label> <input type="text" name="code" value="<?php echo $new_code?>"></input> <label>都道府県市町村郡:</label> <input type="text" name="code2" value="<?php echo $faddy?>"></input> <label>電話</label> <input type="text" name="telephone" value="<?php echo $new_telephone?>"></input> </fieldset> <input type="submit" value="Find>" name="lookup"></input> <input type="submit" value="Go>" name="redirect"></input> </form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.