Topic: Selectbox changes textbox value

I am trying to make a form with a textbox next to a select box.
When the user selects a name, link Tony. I would like the textbox to display Tony's E-mail, like tony@gmail.com.

 format

How to do this function?

Thanks in advance for your any help!

Re: Selectbox changes textbox value

See for jQuery API, it should not too difficult.

Re: Selectbox changes textbox value

Should be close to what you are looking for (using prototype).

<% options1 = [['', ''],
      ['Jack', 'jack@internet.com'],
      ['Jill', 'jill@internet.com'],
      ['John', 'john@internet.com'],
      ['Jane', 'jane@internet.com']] %>

<%= content_tag :label, "User" %>
<%= select_tag :options1, options_for_select(options1), :onchange => "$('name').value=this.value" %>
<%= content_tag :label, "Email" %>
<%= text_field_tag :name %>

Last edited by jmesserer (2010-11-23 16:28:27)