mklebel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-26 19:36 UTC
populate select box by ajax query with Prototype and IE7
Trying to populate a select box with a value passed in from another select box works great in Firefox, but using IE nothing happens, no data is getting returned back. I commented everything out and put alerts in there and the alerts work in IE but when ajax is getting used it seems to just die...Is this a bug or what am I doing wrong? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Diodeus
2007-Jul-26 20:23 UTC
Re: populate select box by ajax query with Prototype and IE7
Please post the URL to a sample page. There''s no reason why this shouldn''t work, so there''s probably something you''re missing in your code. On Jul 26, 3:36 pm, "mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Trying to populate a select box with a value passed in from another > select box works great in Firefox, but using IE nothing happens, no > data is getting returned back. I commented everything out and put > alerts in there and the alerts work in IE but when ajax is getting > used it seems to just die...Is this a bug or what am I doing wrong?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
mklebel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-30 16:01 UTC
Re: populate select box by ajax query with Prototype and IE7
It is an internal site so I cannot link it. But here is the code <form onSubmit="foo();" method="post"><p/> <table style="text-align: left; border: 1px solid #092C4F; font- weight: bold; color: #092C4F" align="center" border="0" cellpadding="3" cellspacing="0"> <tr> <th colspan="4" style="background-color: #092C4F; color: white;" align="center">Add Newspaper</th> </tr> <tr> <?php include(''../adodb_connect.php''); $sql = "SELECT * FROM dba.FxpsNewspaperStates"; $rows = $db->Execute($sql); if ($rows === false) { die($db->ErrorMsg()); } echo "<td><b>State: </b></td><td><div><select onChange\"qryState(this.value),qryDest(this.value);\" id=\"stateID\" name\"stateID\"><option>Please Select</option>"; foreach($rows as $row) { echo "<option value=\"$row[0]\">".$row[2]."</option>"; } echo "</select></div></td>"; ?> <td><b>Market: </b></td> <td><select id="marketID" name="marketID"></select></td> </tr> <tr> <td><b>Destination: </b></td> <td><select id="dest_no" name="dest_no"></select></td> ---------JAVASCRIPT-------- function qryState() { var url = ''../query/qry_State.php''; var params = "stateID=" + $F(''stateID''); var ajax = new Ajax.Updater({success: "marketID"},url,{method: ''post'', parameters: params, onFailure: reportError}); } function qryDest() { var url = ''../query/qry_Dest.php''; var params = "stateID=" + $F(''stateID''); var ajax = new Ajax.Updater({success: "dest_no"},url,{method: ''post'', parameters: params, onFailure: reportError}); } On Jul 26, 3:23 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Please post the URL to a sample page. There''s no reason why this > shouldn''t work, so there''s probably something you''re missing in your > code. > > On Jul 26, 3:36 pm, "mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Trying to populate a select box with a value passed in from another > > select box works great in Firefox, but using IE nothing happens, no > > data is getting returned back. I commented everything out and put > > alerts in there and the alerts work in IE but when ajax is getting > > used it seems to just die...Is this a bug or what am I doing wrong?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Diodeus
2007-Jul-30 19:59 UTC
Re: populate select box by ajax query with Prototype and IE7
It looks like IE doesn''t like contents being shoved into a <SELECT> statement. If you change your code so that marketID is a DIV instead of a <SELECT> you''ll see your code does indeed work. What you''ll likely need to do is get back a list of values, instead of a bunch of <option> tags and add the new options to the marketID selection using code. On Jul 30, 12:01 pm, "mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It is an internal site so I cannot link it. But here is the code > > <form onSubmit="foo();" method="post"><p/> > <table style="text-align: left; border: 1px solid #092C4F; font- > weight: bold; color: #092C4F" align="center" border="0" > cellpadding="3" cellspacing="0"> > <tr> > <th colspan="4" style="background-color: #092C4F; color: white;" > align="center">Add Newspaper</th> > </tr> > <tr> > <?php > include(''../adodb_connect.php''); > $sql = "SELECT * FROM dba.FxpsNewspaperStates"; > $rows = $db->Execute($sql); > > if ($rows === false) > { > die($db->ErrorMsg()); > } > > echo "<td><b>State: </b></td><td><div><select onChange> \"qryState(this.value),qryDest(this.value);\" id=\"stateID\" name> \"stateID\"><option>Please Select</option>"; > foreach($rows as $row) > { > echo "<option value=\"$row[0]\">".$row[2]."</option>"; > } > echo "</select></div></td>"; > ?> > <td><b>Market: </b></td> > <td><select id="marketID" name="marketID"></select></td> > </tr> > <tr> > <td><b>Destination: </b></td> > <td><select id="dest_no" name="dest_no"></select></td> > > ---------JAVASCRIPT-------- > function qryState() > { > var url = ''../query/qry_State.php''; > var params = "stateID=" + $F(''stateID''); > var ajax = new Ajax.Updater({success: "marketID"},url,{method: > ''post'', parameters: params, onFailure: reportError}); > > } > > function qryDest() > { > var url = ''../query/qry_Dest.php''; > var params = "stateID=" + $F(''stateID''); > var ajax = new Ajax.Updater({success: "dest_no"},url,{method: ''post'', > parameters: params, onFailure: reportError}); > > } > > On Jul 26, 3:23 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Please post the URL to a sample page. There''s no reason why this > > shouldn''t work, so there''s probably something you''re missing in your > > code. > > > On Jul 26, 3:36 pm, "mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Trying to populate a select box with a value passed in from another > > > select box works great in Firefox, but using IE nothing happens, no > > > data is getting returned back. I commented everything out and put > > > alerts in there and the alerts work in IE but when ajax is getting > > > used it seems to just die...Is this a bug or what am I doing wrong?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
mklebel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-31 14:08 UTC
Re: populate select box by ajax query with Prototype and IE7
aha, I just make the query post inside of a <td> instead of <select> and it works. On Jul 30, 2:59 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It looks like IE doesn''t like contents being shoved into a <SELECT> > statement. If you change your code so that marketID is a DIV instead > of a <SELECT> you''ll see your code does indeed work. > > What you''ll likely need to do is get back a list of values, instead of > a bunch of <option> tags and add the new options to the marketID > selection using code. > > On Jul 30, 12:01 pm, "mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > It is an internal site so I cannot link it. But here is the code > > > <form onSubmit="foo();" method="post"><p/> > > <table style="text-align: left; border: 1px solid #092C4F; font- > > weight: bold; color: #092C4F" align="center" border="0" > > cellpadding="3" cellspacing="0"> > > <tr> > > <th colspan="4" style="background-color: #092C4F; color: white;" > > align="center">Add Newspaper</th> > > </tr> > > <tr> > > <?php > > include(''../adodb_connect.php''); > > $sql = "SELECT * FROM dba.FxpsNewspaperStates"; > > $rows = $db->Execute($sql); > > > if ($rows === false) > > { > > die($db->ErrorMsg()); > > } > > > echo "<td><b>State: </b></td><td><div><select onChange> > \"qryState(this.value),qryDest(this.value);\" id=\"stateID\" name> > \"stateID\"><option>Please Select</option>"; > > foreach($rows as $row) > > { > > echo "<option value=\"$row[0]\">".$row[2]."</option>"; > > } > > echo "</select></div></td>"; > > ?> > > <td><b>Market: </b></td> > > <td><select id="marketID" name="marketID"></select></td> > > </tr> > > <tr> > > <td><b>Destination: </b></td> > > <td><select id="dest_no" name="dest_no"></select></td> > > > ---------JAVASCRIPT-------- > > function qryState() > > { > > var url = ''../query/qry_State.php''; > > var params = "stateID=" + $F(''stateID''); > > var ajax = new Ajax.Updater({success: "marketID"},url,{method: > > ''post'', parameters: params, onFailure: reportError}); > > > } > > > function qryDest() > > { > > var url = ''../query/qry_Dest.php''; > > var params = "stateID=" + $F(''stateID''); > > var ajax = new Ajax.Updater({success: "dest_no"},url,{method: ''post'', > > parameters: params, onFailure: reportError}); > > > } > > > On Jul 26, 3:23 pm, Diodeus <diod...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Please post the URL to a sample page. There''s no reason why this > > > shouldn''t work, so there''s probably something you''re missing in your > > > code. > > > > On Jul 26, 3:36 pm, "mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mkle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Trying to populate a select box with a value passed in from another > > > > select box works great in Firefox, but using IE nothing happens, no > > > > data is getting returned back. I commented everything out and put > > > > alerts in there and the alerts work in IE but when ajax is getting > > > > used it seems to just die...Is this a bug or what am I doing wrong?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---