Hi Diodeus, Can't seem to get it to work correctly... I can get it to appear in a div tag though, i know that it's something simple that I am doing wrong to make it show in a as the value of a text box.
Like this : var url = 'ajax.zip_code.php'; var params = 'zip=' + $F('cust_zipcode'); var ajax = new Ajax.Updater('document.form1.cust_city.value', url, {method: 'post', parameters: params} or This var url = 'ajax.zip_code.php'; var params = 'zip=' + $F('cust_zipcode'); var ajax = new Ajax.Updater('cust_city', url, {method: 'post', parameters: params} Thanks, Joe On Mar 24, 2:25 pm, Diodeus <[EMAIL PROTECTED]> wrote: > Since you're using Ajax.updater and not Ajax.Request, you need to > supply the ID of the element you wish to update. > > Typically the syntax is as follows: > > new Ajax.Updater(el, url, { method: 'get' }); > > el = ID of the element you're updating. In your case, use something > like <input id='city'>, so use 'city' as your ID in your call > > url = if you're using GET you can pass the parameter in the URL, so in > your case the URL is: > > 'ajax.zip_code.php?zip=' + $F('cust_zipcode'); > > You can add the error handing if you want to. > > Giv it a try. > > On Mar 24, 2:32 pm, Joey H <[EMAIL PROTECTED]> wrote: > > > Hello... New to prototype... I know this is probably just really > > really simple but i have not been able to find a good tutorial > > explination or documetation explination for how to do this... I Would > > like this code to update the value of the cust_city form field... > > > thanks in advance for the help :o) > > > <CODE> > > > <script type="text/javascript" src="../prototype.js"></script> > > <script> > > function checkZip() { > > if($F('cust_zipcode').length == 5) { > > > var url = 'ajax.zip_code.php'; > > var params = 'zip=' + $F('cust_zipcode'); > > > var ajax = new Ajax.Updater( > > {success: 'zipResult'}, > > url, > > {method: 'post', parameters: > > params, onFailure: reportError} > > ); > > > } > > } > > > function reportError(request) { > > $F('zipResult') = "Error"; > > } > > </script> > > > .. > > ... > > > <input name="cust_zipcode" type="text" id="cust_zipcode" tabindex="6" > > size="13" onkeyup="checkZip();" /> > > > <input name="cust_city" type="text" id="cust_city" size="35" /> > > > </ > > CODE> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---