On Mon, 2007-11-12 at 10:44 -0800, Will Smith wrote:
> Please show me a simple example such as auto complete or chained
> select fields.

That's too much work.  How about googling "dojo autocomplete", and
reading an article like this:

http://today.java.net/pub/a/today/2006/04/27/building-ajax-with-dojo-and-json.html

To make that work with Catalyst, just replace the java:

   public String toJSONString() throws JSONException {
    JSONObject jsonObj = new JSONObject();
    jsonObj.put("bookId", new Integer(this.bookId));
    jsonObj.put("title", this.title);
    jsonObj.put("isbn", this.isbn);
    jsonObj.put("author", this.author);
    return jsonObj.toString();
   }

With Perl:

   sub search_for_book :Local {
      my ($self, $c, $search_term) = @_;
      my @results = $c->model('Books')->search_for_completion_of($search_term);
      $c->stash->{json} = { results => [EMAIL PROTECTED] };
      $c->detach($c->view('JSON'));
      # or whatever
   } 

Catalyst rarely cares what you use for javascript.  You send the
javascript code data, the javascript does its thing, and perhaps the
javascript requests some more data.  The hard part is javascript, so
that's what you need to learn first.

Regards,
Jonathan Rockway



_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to