On Mar 1, 2011, at 10:22 AM, Jason 'XenoPhage' Frisvold wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/01/2011 12:28 AM, Walter Lee Davis wrote:
Well, this would be easier and more Prototype-y if you used an event
listener instead of an onclick to open your function. If you did that, you would have access to the Event.element() function, which would give
you an extended object reference to the element you clicked on. From
there it's very simple to update your input.

An event listener, you say.  Hrm...  I'll look into that.

Something like this:

<!-- include a fallback link for non-scripted browsers -->
<a class="edit_tags" href="/tags/edit/42">Edit</a>

document.observe('click',function(evt){
        var elm;
        if(elm = evt.findElement('a.edit_tags'){
                cancel the click, since you're grabbing it in JS
                evt.stop(); //
                //do your magic here
                var yourTagsAsText =['foo','bar','baz'].join(',');
                elm.next('input').setValue(yourTagsAsText);
        }
});



And then, whenever you've come up with your list of tags, all you need
to do to to write the value back in is this:

   elm.next('input').setValue(yourTagListAsText);

Aha !  I think this is what I was looking for.  Thanks.

Walter

- --
- ---------------------------
Jason 'XenoPhage' Frisvold
xenoph...@godshell.com
- ---------------------------
"Any sufficiently advanced magic is indistinguishable from technology."
- - Niven's Inverse of Clarke's Third Law
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1tD00ACgkQ8CjzPZyTUTSXNwCgopvngxeYRUu8XL4eToLZ8fHu
5rwAn3dNmjN5plpphLPQhsZ2qBPTll4i
=zd7Q
-----END PGP SIGNATURE-----

--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en .


--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to