Further to this, having spent days stepping through javascript, it seems 
the following is happening, hopefully my description will not be too off 
the mark.

In the example I am using, they use a bit of javascript to 'hook' the ajax 
form, as follows:

    // Edit a task when the edit link is clicked in the actions dropdown
>     $("a.todo-edit").click(function(e) {
>         e.preventDefault();
>         var todo_id = $(this).closest('ul').attr('id');
>         $.getJSON(
>             '/edit.task',
>             {'id': todo_id},
>             function(json) {
>                 if (json) {
>                     edit_form = $('#task-form');
>                     // Set the title to Edit
>                     edit_form.find('h3').text('Edit Task');
>                     $.each(json, function(k, v) {
>                         // Set the value for each field from the returned 
> json
>                         var target=edit_form.find('input[name="' + k + 
> '"]')
>                         target.attr('value', v);
>                         // Re-initialize the fancy tags input
>                         if (k === 'tags') {
>                             
> edit_form.find('input[name="tags"]').importTags(v);
>                         }
>                     });
>                     edit_form.modal('show');
>                 }
>             }
>         );
>     });
>
 
(slightly modified to make tracking easier)
Now, that seems to work for setting values that are inputs (ie: standard 
text fields), however does not work for selects, so it needs the following 
also added:

var target=edit_form.find('select[name="' + k + '"]')
target.attr('value', v);

now, that makes select (dropdown) widgets work, of course it will also need 
some even more complex code to support CheckboxChoice widgets, etc.

That all seems VERY manual, just to get a triggering of an ajax form load, 
I have to assume this is NOT the right way.

Could anyone PLEASE comment on either why things are this manual, or what 
is being done wrong?

Thank you kindly.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to