Sounds like the Ajax.Updater should be your first port of call, then. http://www.prototypejs.org/api/ajax/updater You don''t even need a ''select'' button, you can set mouse click events on any DOM element, e.g. the table row, or the first cell, or whatever http://www.prototypejs.org/api/event/observe Have fun! Dave On Friday 30 March 2007 15:32, EWonka wrote:> Thanks Ryan, > > It''s a fairly simple requirement actually, an ajax request will be > sent to the application server and it will return data. The data will > be comprised of a job description and id. I would like to take the > data and form a display that for each row will contain a ''select > button'', description, id. > > The user will simply press the button (labeled "Select") for the > specific row and the job description will be populated on the orginal > form in a textbox. I am trying to avoid the classic drop down and go > with "something" similar to a table type display. Your patience is > appreciated. thank you. > > On Mar 30, 10:16 am, "Ryan Gahl" <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > While your requirements at this point are pretty vague... I''ll just say > > yes, and that you should look, possibly, at scriptaculous''s AutoCompleter > > control. > > > > On 3/30/07, EWonka <Chasis...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > Hello All, > > > > > > Been out of web development for a while; however I have a question > > > with regard to Ajax and Javascripts. A requirement exists to perform a > > > query from the browser using Ajax request and response objects. Once > > > the data is returned, I need to display the query results. Rather than > > > just creating a popup to display a selectable list, are there any > > > other techniques, perhaps using scriptaculous or prototype scripts as > > > an alternative? Say modifying the DOM elements. > > > > > > Thank you, > > > > -- > > Ryan Gahl > > Application Development Consultant > > Athena Group, Inc. > > Inquire: 1-920-955-1457 > > Blog:http://www.someElement.com- Hide quoted text - > > > > - Show quoted text - > > > > > -- > This email has been verified as Virus free > Virus Protection and more available at http://www.plus.net-- ---------------------- Author Ajax in Action http://manning.com/crane Ajax in Practice http://manning.com/crane2 Prototype & Scriptaculous in Action http://manning.com/crane3 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello All, Been out of web development for a while; however I have a question with regard to Ajax and Javascripts. A requirement exists to perform a query from the browser using Ajax request and response objects. Once the data is returned, I need to display the query results. Rather than just creating a popup to display a selectable list, are there any other techniques, perhaps using scriptaculous or prototype scripts as an alternative? Say modifying the DOM elements. Thank you, --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
While your requirements at this point are pretty vague... I''ll just say yes, and that you should look, possibly, at scriptaculous''s AutoCompleter control. On 3/30/07, EWonka <Chasisr22-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote:> > > Hello All, > > Been out of web development for a while; however I have a question > with regard to Ajax and Javascripts. A requirement exists to perform a > query from the browser using Ajax request and response objects. Once > the data is returned, I need to display the query results. Rather than > just creating a popup to display a selectable list, are there any > other techniques, perhaps using scriptaculous or prototype scripts as > an alternative? Say modifying the DOM elements. > > Thank you, > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-920-955-1457 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks Ryan, It''s a fairly simple requirement actually, an ajax request will be sent to the application server and it will return data. The data will be comprised of a job description and id. I would like to take the data and form a display that for each row will contain a ''select button'', description, id. The user will simply press the button (labeled "Select") for the specific row and the job description will be populated on the orginal form in a textbox. I am trying to avoid the classic drop down and go with "something" similar to a table type display. Your patience is appreciated. thank you. On Mar 30, 10:16 am, "Ryan Gahl" <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> While your requirements at this point are pretty vague... I''ll just say yes, > and that you should look, possibly, at scriptaculous''s AutoCompleter > control. > > On 3/30/07, EWonka <Chasis...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > > > > Hello All, > > > Been out of web development for a while; however I have a question > > with regard to Ajax and Javascripts. A requirement exists to perform a > > query from the browser using Ajax request and response objects. Once > > the data is returned, I need to display the query results. Rather than > > just creating a popup to display a selectable list, are there any > > other techniques, perhaps using scriptaculous or prototype scripts as > > an alternative? Say modifying the DOM elements. > > > Thank you, > > -- > Ryan Gahl > Application Development Consultant > Athena Group, Inc. > Inquire: 1-920-955-1457 > Blog:http://www.someElement.com- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That is very possible. I would argue that it would be better to use a drop-down list that could then have an onChange event handler or event a button which would, when clicked, get the value of the drop-down list (you should investigate the $F() function for this; it''s in the Utility Methods) and then use Ajax.Updater to get the information from the server and display it in the DOM element of your choice. -- Dash -- EWonka wrote:> Thanks Ryan, > > It''s a fairly simple requirement actually, an ajax request will be > sent to the application server and it will return data. The data will > be comprised of a job description and id. I would like to take the > data and form a display that for each row will contain a ''select > button'', description, id. > > The user will simply press the button (labeled "Select") for the > specific row and the job description will be populated on the orginal > form in a textbox. I am trying to avoid the classic drop down and go > with "something" similar to a table type display. Your patience is > appreciated. thank you. > > > On Mar 30, 10:16 am, "Ryan Gahl" <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> While your requirements at this point are pretty vague... I''ll just say yes, >> and that you should look, possibly, at scriptaculous''s AutoCompleter >> control. >> >> On 3/30/07, EWonka <Chasis...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: >> >> >> >> >> >> >> >> >>> Hello All, >>> >>> Been out of web development for a while; however I have a question >>> with regard to Ajax and Javascripts. A requirement exists to perform a >>> query from the browser using Ajax request and response objects. Once >>> the data is returned, I need to display the query results. Rather than >>> just creating a popup to display a selectable list, are there any >>> other techniques, perhaps using scriptaculous or prototype scripts as >>> an alternative? Say modifying the DOM elements. >>> >>> Thank you, >>> >> -- >> Ryan Gahl >> Application Development Consultant >> Athena Group, Inc. >> Inquire: 1-920-955-1457 >> Blog:http://www.someElement.com- Hide quoted text - >> >> - Show quoted text - >> > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
And this could also be a simple case for the AHAH pattern: http://en.wikipedia.org/wiki/Ahah On 3/30/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> > That is very possible. I would argue that it would be better to use a > drop-down list that could then have an onChange event handler or event a > button which would, when clicked, get the value of the drop-down list (you > should investigate the $F() function for this; it''s in the Utility Methods) > and then use Ajax.Updater to get the information from the server and > display it in the DOM element of your choice. > > -- Dash -- > > EWonka wrote: > > Thanks Ryan, > > It''s a fairly simple requirement actually, an ajax request will be > sent to the application server and it will return data. The data will > be comprised of a job description and id. I would like to take the > data and form a display that for each row will contain a ''select > button'', description, id. > > The user will simply press the button (labeled "Select") for the > specific row and the job description will be populated on the orginal > form in a textbox. I am trying to avoid the classic drop down and go > with "something" similar to a table type display. Your patience is > appreciated. thank you. > > > On Mar 30, 10:16 am, "Ryan Gahl" <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> <ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > While your requirements at this point are pretty vague... I''ll just say yes, > and that you should look, possibly, at scriptaculous''s AutoCompleter > control. > > On 3/30/07, EWonka <Chasis...-Wuw85uim5zDR7s880joybQ@public.gmane.org> <Chasis...-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > > > > > > Hello All, > > Been out of web development for a while; however I have a question > with regard to Ajax and Javascripts. A requirement exists to perform a > query from the browser using Ajax request and response objects. Once > the data is returned, I need to display the query results. Rather than > just creating a popup to display a selectable list, are there any > other techniques, perhaps using scriptaculous or prototype scripts as > an alternative? Say modifying the DOM elements. > > Thank you, > > -- > Ryan Gahl > Application Development Consultant > Athena Group, Inc. > Inquire: 1-920-955-1457 > Blog:http://www.someElement.com- Hide quoted text - > > - Show quoted text - > > > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-920-955-1457 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Assuming your data is something that ends up as a data-structure on the
client-side (JSON preferably), just loop through building your nodes as
you go. A table doesn''t seem necessary since you really only have one
column..<br>
<br>
Response example (server data encoded to JSON):<br>
[{desc:''Job Description
1'',id:''1''},{desc:''Job Description
2'',id:''2''}]<br>
<br>
I would probably use Ajax.Request to create a popup or something, or
Ajax.Updater with an overridden insertion function like so:<br>
<br>
CSS:<br>
ul.joblist li { cursor: pointer; }<br>
ul.joblist li:hover { background-color: #ffffee; }<br>
<br>
Javascript<br>
new
Ajax.Updater(''pickone'',''page'',{<br>
insertion: function(element,update){ //server responds with
json
object in response body<br>
var json = update.evalJSON();<br>
var list =
Builder.node(''ul'',{className:''joblist''});<br>
element.appendChild(list);<br>
json.each(function(job){<br>
var li =
Builder.node(''li'',{id:''jobid-''+job.id},[job.desc]);<br>
Event.observe(li,''click'',populate);<br>
list.appendChild(li);<br>
});<br>
}<br>
}<br>
function populate(event){<br>
var element = Event.element(event);<br>
id =
element.id.split(''-'')[1];<br>
new
Ajax.Updater(''jobdesc'',''page'',{parameters:
{id: id}});<br>
//destroy the list? remove element.parentChild
and be sure to
cleanup event observers<br>
}<br>
<br>
I also have a very lightweight tooltip class that includes the ability
to create a popup and populate it easily with elements that have event
handlers that will be cleaned up when the popup is closed if you are
concerned about proper cleanup.<br>
<br>
This looks strangely familiar to Autocompleter! Maybe that would be
something to look at...<br>
<br>
Colin<br>
<br>
EWonka wrote:
<blockquote
cite="mid:1175265133.371471.194240-3YCkWntIiMufAYmsQHFBWGB/v6IoIuQBVpNB7YpNyf8@public.gmane.org"
type="cite">
<pre wrap="">Thanks Ryan,
It''s a fairly simple requirement actually, an ajax request will be
sent to the application server and it will return data. The data will
be comprised of a job description and id. I would like to take the
data and form a display that for each row will contain a ''select
button'', description, id.
The user will simply press the button (labeled "Select") for the
specific row and the job description will be populated on the orginal
form in a textbox. I am trying to avoid the classic drop down and go
with "something" similar to a table type display. Your patience is
appreciated. thank you.
On Mar 30, 10:16 am, "Ryan Gahl" <a
class="moz-txt-link-rfc2396E"
href="mailto:ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"><ryan.g...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org></a>
wrote:
</pre>
<blockquote type="cite">
<pre wrap="">While your requirements at this point are
pretty vague... I''ll just say yes,
and that you should look, possibly, at scriptaculous''s AutoCompleter
control.
On 3/30/07, EWonka <a class="moz-txt-link-rfc2396E"
href="mailto:Chasis...-Wuw85uim5zDR7s880joybQ@public.gmane.org"><Chasis...-Wuw85uim5zDR7s880joybQ@public.gmane.org></a>
wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello All,
</pre>
</blockquote>
<blockquote type="cite">
<pre wrap="">Been out of web development for a while;
however I have a question
with regard to Ajax and Javascripts. A requirement exists to perform a
query from the browser using Ajax request and response objects. Once
the data is returned, I need to display the query results. Rather than
just creating a popup to display a selectable list, are there any
other techniques, perhaps using scriptaculous or prototype scripts as
an alternative? Say modifying the DOM elements.
</pre>
</blockquote>
<blockquote type="cite">
<pre wrap="">Thank you,
</pre>
</blockquote>
<pre wrap="">--
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-955-1457
Blog:<a class="moz-txt-link-freetext"
href="http://www.someElement.com">http://www.someElement.com</a>-
Hide quoted text -
- Show quoted text -
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
--~--~---------~--~----~------------~-------~--~----~<br>
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group. <br> To post to this
group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To
unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
<br> For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en <br>
-~----------~----~----~----~------~----~------~--~---<br>
</body>
</html>
<br>
On Mar 31, 1:40 am, David Dashifen Kees <dashi...-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> That is very possible. I would argue that it would be better to use a > drop-down list that could then have an onChange event handlerSelect elements using change events have well known accessibility problems - if you try to navigate them using the cursor keys, some browses will fire a change event every time a key is pressed and the selection changes. In other browsers, nothing happens until the control loses focus and the selection has changed from when the control got focus. Try this in IE: <select onchange="$(''d0'').innerHTML += ''<br>''+this.value;"> <option value="zero">zero <option value="one">one <option value="two">two <option value="three">three </select> <div id="d0"></div> -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Wow. Good to know, thanks. -- Dash -- RobG wrote:> > On Mar 31, 1:40 am, David Dashifen Kees <dashi...-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > >> That is very possible. I would argue that it would be better to use a >> drop-down list that could then have an onChange event handler >> > > Select elements using change events have well known accessibility > problems - if you try to navigate them using the cursor keys, some > browses will fire a change event every time a key is pressed and the > selection changes. In other browsers, nothing happens until the > control loses focus and the selection has changed from when the > control got focus. > > Try this in IE: > > <select onchange="$(''d0'').innerHTML += ''<br>''+this.value;"> > <option value="zero">zero > <option value="one">one > <option value="two">two > <option value="three">three > </select> > <div id="d0"></div> > > > -- > Rob > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---