I have a Stripes app with a form w/ two components:

1.  A dynamic drop-down populated with all the states in the US
2.  A text-field I want to be dynamically populated w/ cities (in the
selected state) using auto-complete as the user types

I've chosen to use this Prototype library to do my auto-complete:
http://www.devbridge.com/projects/autocomplete/ (Any alternative/better
suggestions?)

I'm having a hard time understanding how to tie this all together.  I've
setup an Ajax.Request to set the state the user selects:

    new Ajax.Request('/app/AddItemForm.action?item.state=' + 
                             control.options[control.selectedIndex].value, 
                             { method: 'get' });

But I'm now stuck on how to "load" my Stripes city text-field as the user
types:

    <s:text id="item-city" name="item.city" class="required"/>

The example given is as follows:

    <script type="text/javascript">
        new Autocomplete('item-city', {
serviceUrl:'service/autocomplete.ashx' });
    </script>

I'm not sure how this should translate into the Stripes world.  Do I want to
make a call to an action or a JSP?, Either way, how do I get it to return
JSON city data in the format needed?

My idea thus-far was to set the item state as the user typed, I append the
state selected (set on the item object w/ the AJAX.Request) and execute a
query where take the user's input and return a list of cities, but I'm not
at all sure if that's the right approach.

Alternatively, is there a different/easier way to accomplish what I'm trying
to do?

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/JSON-data-from-Stripes-for-Prototype-Library-tp25628119p25628119.html
Sent from the stripes-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to