All, Im using prototype to make a request using form field. Here is the code. I''d like to select a choice from the select menu then have that submit as a param for my new Ajax.Request. The code works when using a simple alert to print out the choice, but I can seem to pass it into the new Ajax.Request function. Any ideas? <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript"> function doWork(){ var selected = document.forms["typeForm"]["type"]; var choice = selected.value; alert(choice); new Ajax.Request(''history'',''pollQueue.jsp'', { method: ''get'', parameters: {type: ''ERROR''} }); } form: <form name="typeForm"> <select name="type" onChange="doWork()"> <option value="INFO">INFO</option> <option value="WARN">WARN</option> <option value="FATAL">FATAL</option> <option value="ERROR">ERROR</option> <option value="DEBUG">DEBUG</option> </select> div: <div id="history"></div> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
<script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript"> function doWork(){ var selected = document.forms["typeForm"]["type"]; var choice = selected.value; alert(choice); new Ajax.Request(''history'',''pollQueue.jsp'', { method: ''get'', parameters: $("form").serialize() }); } form: <form name="typeForm"> <select name="type" onChange="doWork()"> <option value="INFO">INFO</option> <option value="WARN">WARN</option> <option value="FATAL">FATAL</option> <option value="ERROR">ERROR</option> <option value="DEBUG">DEBUG</option> </select> div: <div id="history"></div> On Dec 10, 2007 3:58 PM, mc1392 <michaelclayton6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > All, > > Im using prototype to make a request using form field. Here is the > code. > I''d like to select a choice from the select menu then have that submit > as a param for my new Ajax.Request. > The code works when using a simple alert to print out the choice, but > I can seem to pass it into the new Ajax.Request function. > > Any ideas? > > <script type="text/javascript" src="js/prototype.js"></script> > <script type="text/javascript"> > function doWork(){ > var selected = document.forms["typeForm"]["type"]; > var choice = selected.value; > alert(choice); > new Ajax.Request(''history'',''pollQueue.jsp'', { > method: ''get'', > parameters: {type: ''ERROR''} > }); > > } > > > form: > > <form name="typeForm"> > <select name="type" onChange="doWork()"> > <option value="INFO">INFO</option> > <option value="WARN">WARN</option> > <option value="FATAL">FATAL</option> > <option value="ERROR">ERROR</option> > <option value="DEBUG">DEBUG</option> > </select> > > div: > > <div id="history"></div> > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Correct me if I''m wrong, but don''t you need to use Ajax.Updater instead of Ajax.Request? The Request method takes the url as the first parameter while you have the id of the element that needs to be updated there. Greetz, Wizz On Dec 11, 12:00 am, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <script type="text/javascript" src="js/prototype.js"></script> > <script type="text/javascript"> > function doWork(){ > var selected = document.forms["typeForm"]["type"]; > var choice = selected.value; > alert(choice); > new Ajax.Request(''history'',''pollQueue.jsp'', { > method: ''get'', > parameters: $("form").serialize() > }); > > } > > form: > > <form name="typeForm"> > <select name="type" onChange="doWork()"> > <option value="INFO">INFO</option> > <option value="WARN">WARN</option> > <option value="FATAL">FATAL</option> > <option value="ERROR">ERROR</option> > <option value="DEBUG">DEBUG</option> > </select> > > div: > > <div id="history"></div> > > On Dec 10, 2007 3:58 PM, mc1392 <michaelclayt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > All, > > > Im using prototype to make a request using form field. Here is the > > code. > > I''d like to select a choice from the select menu then have that submit > > as a param for my new Ajax.Request. > > The code works when using a simple alert to print out the choice, but > > I can seem to pass it into the new Ajax.Request function. > > > Any ideas? > > > <script type="text/javascript" src="js/prototype.js"></script> > > <script type="text/javascript"> > > function doWork(){ > > var selected = document.forms["typeForm"]["type"]; > > var choice = selected.value; > > alert(choice); > > new Ajax.Request(''history'',''pollQueue.jsp'', { > > method: ''get'', > > parameters: {type: ''ERROR''} > > }); > > > } > > > form: > > > <form name="typeForm"> > > <select name="type" onChange="doWork()"> > > <option value="INFO">INFO</option> > > <option value="WARN">WARN</option> > > <option value="FATAL">FATAL</option> > > <option value="ERROR">ERROR</option> > > <option value="DEBUG">DEBUG</option> > > </select> > > > div: > > > <div id="history"></div>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
yes, i miss that detail =D On Dec 11, 2007 6:31 AM, Wizz <woutawizz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Correct me if I''m wrong, but don''t you need to use Ajax.Updater > instead of Ajax.Request? > > The Request method takes the url as the first parameter while you have > the id of the element that needs to be updated there. > > Greetz, > > Wizz > > On Dec 11, 12:00 am, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > <script type="text/javascript" src="js/prototype.js"></script> > > <script type="text/javascript"> > > function doWork(){ > > var selected = document.forms["typeForm"]["type"]; > > var choice = selected.value; > > alert(choice); > > new Ajax.Request(''history'',''pollQueue.jsp'', { > > method: ''get'', > > parameters: $("form").serialize() > > }); > > > > } > > > > form: > > > > <form name="typeForm"> > > <select name="type" onChange="doWork()"> > > <option value="INFO">INFO</option> > > <option value="WARN">WARN</option> > > <option value="FATAL">FATAL</option> > > <option value="ERROR">ERROR</option> > > <option value="DEBUG">DEBUG</option> > > </select> > > > > div: > > > > <div id="history"></div> > > > > On Dec 10, 2007 3:58 PM, mc1392 <michaelclayt...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > All, > > > > > Im using prototype to make a request using form field. Here is the > > > code. > > > I''d like to select a choice from the select menu then have that submit > > > as a param for my new Ajax.Request. > > > The code works when using a simple alert to print out the choice, but > > > I can seem to pass it into the new Ajax.Request function. > > > > > Any ideas? > > > > > <script type="text/javascript" src="js/prototype.js"></script> > > > <script type="text/javascript"> > > > function doWork(){ > > > var selected = document.forms["typeForm"]["type"]; > > > var choice = selected.value; > > > alert(choice); > > > new Ajax.Request(''history'',''pollQueue.jsp'', { > > > method: ''get'', > > > parameters: {type: ''ERROR''} > > > }); > > > > > } > > > > > form: > > > > > <form name="typeForm"> > > > <select name="type" onChange="doWork()"> > > > <option value="INFO">INFO</option> > > > <option value="WARN">WARN</option> > > > <option value="FATAL">FATAL</option> > > > <option value="ERROR">ERROR</option> > > > <option value="DEBUG">DEBUG</option> > > > </select> > > > > > div: > > > > > <div id="history"></div> > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---