[Gllug] Dropdown list value in text area

Progga progga at BengaLinux.Org
Sat May 26 05:57:03 UTC 2007


On Fri, May 25, 2007 at 02:37:16PM +0100, diego gentoo wrote:

>  Homework? Just trying to custom Trac...

Now that you have confirmed it's not a homework, here's a quick and dirty
solution in Javascript:

---------------------------------------------------------------------------

<form name="form0" method="GET" action="whatever.whatever">
  <select name="disney_char"
      onchange="document.form0.guest_star.value = options[selectedIndex].text">
    <option value="mickey">Mickey Mouse</option>
    <option value="mini">Mini Mouse</option>
    <option value="donald">Donald Duck</option>
  </select>  

  <input name="guest_star" type="text" />

  <input type="submit" value="Submit" />
</form>

---------------------------------------------------------------------------

'onchange="document.form0.guest_star.value = options[selectedIndex].text' copies
the selected value to the textbox named "guest_star".

BTW, Javascript is the only way to do it since Trac is a web app.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20070526/242d1131/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list