Thanks to both of you for the help. Your comments helped steer me in the right direction.<br><br>I'm using the behaviour.js library so has allowed me to simplify it somewhat. Here is my js:<br><br> '.tag_link' : function(el){
<br> el.onclick = function(){<br> var str = document.tag_form.discover.value + ", " + el.rel<br> document.tag_form.discover.value = str;<br> }<br> },<br><br>And my form:<br>
<br><form name="tag_form"><br><input type="text" name="all" id="discover" size="16" value="test1, test2"/><br><a href="#" rel="mytag1" class="tag_link">click me</a><br />
<br><a href="#" rel="mytag2" class="tag_link">click me</a><br /><br><a href="#" rel="mytag3" class="tag_link">click me</a><br />
<br></form><br><br>It validates (except for not having an action in the form tag, which I'll add in a bit. Does anyone see any problems with this? Seems to work fine. <br><br>Steve<br><a href="http://www.smarkets.net">
http://www.smarkets.net</a><br><br><div><span class="gmail_quote">On 3/31/06, <b class="gmail_sendername"><a href="mailto:njmacinnes@gmail.com">njmacinnes@gmail.com</a></b> <<a href="mailto:njmacinnes@gmail.com">njmacinnes@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Well, first of all, the button should be between the <form> ...<br>
</form> tags (it should work even if not, but lets just be strictly<br>correct).<br>Your form needs a name, for example <form name="form1">. Then its'<br>onClick="document.form1.discover.value = test3, test4" Notice only one
<br>equals, not two? That should sort it out. Hope that's helped.<br>-N<br><br>On 31/03/06, Steve Odom <<a href="mailto:steve.odom@gmail.com">steve.odom@gmail.com</a>> wrote:<br>> Hi list,<br>><br>> I have a list of tags. I want to be able to click on a tag and have that tag
<br>> name populate an input field. I think delicious used to allow you to click<br>> on existing links to tag your bookmark similar to this (moving instead to<br>> auto_complete).<br>><br>> My guess is the code looks something like this....
<br>> <form><br>> <input type="text" name="all" id="discover" size="16" value="test1, test2"/><br>> </form><br>><br>> <a href onClick="
document.form.discover.value == 'test3, test4'">click<br>> me</a><br>><br>> ...but I can't get it to work. Any suggestions?<br>><br>> Thanks,<br>><br>> Steve<br>> <a href="http://www.smarkets.net">
http://www.smarkets.net</a><br>><br>> _______________________________________________<br>> Rails mailing list<br>> <a href="mailto:Rails@lists.rubyonrails.org">Rails@lists.rubyonrails.org</a><br>> <a href="http://lists.rubyonrails.org/mailman/listinfo/rails">
http://lists.rubyonrails.org/mailman/listinfo/rails</a><br>><br>><br>><br>_______________________________________________<br>Rails mailing list<br><a href="mailto:Rails@lists.rubyonrails.org">Rails@lists.rubyonrails.org
</a><br><a href="http://lists.rubyonrails.org/mailman/listinfo/rails">http://lists.rubyonrails.org/mailman/listinfo/rails</a><br></blockquote></div><br>