Nesting select and text_field in radio_button

I'm creating my first Rails app and need an idea creating forms.

I have Meeting model with place attribute.

I want to have two fields for Meeting.place = one would be select with
places from other meetings or text_field if the place is being used
first time. User would be selecting radio_button of which field he has
used.

So is there any way to nest select and text_field within 2
radio_buttons?

I would appreciate any other solution ideas too.
Cheers

Why bother with the radio buttons?

If there's something in the text field use it; otherwise use the value from
the select. (You'll want to check that at least one has a value anyway.)

Why bother with the radio buttons?

If there's something in the text field use it; otherwise use the value
from
the select. (You'll want to check that at least one has a value anyway.)

Is it possible to check it in view or only in controller after
submitting the form??

This one is only populating :place param from the last :place field

= form_for @meeting do |f|
  ...
  .field
    = f.label :place
    = f.text_field :place
  .field
    = f.label :place
    = f.select :place, options_for_select(Meeting.places,
params[:place])
  .field
    = f.label :total_places
    = f.text_field :total_places
  .actions
    = f.submit 'Save'

I'm newbie and haven't seen similar form in books.

Other idea is to populate text from select box into text_field - how
about that??

Is it possible to check it in view or only in controller after
submitting the form??

You need that information in the controller, so might as well put the
logic there (IMO).

This one is only populating :place param from the last :place field

The two form elements need to have different names.

Here's how I usually solve this (requires Prototype, you'll have to translate if you're using jQuery):

<script type="text/javascript>
  if($('user_practice_id')){
    $('user_practice_id').options[$('user_practice_id').options.length] = new Option('New...','New...');
    $('user_practice_id').observe('change',function(evt){
      if($F(this) == 'New...'){
        var text_input = new Element('input',{type:'text',size:'60',name:'practice_name',id:'practice_name'});
        this.insert({before:text_input});
        text_input.focus();
        text_input['_bak'] = $('user_practice_id').hide().options.selectedIndex = 0;
        text_input.observe('blur',function(evt){
          if($F(this) == '' && this._bak){
            this._bak.show();
            this.remove();
          }
        });
      }
    });
  }
</script>

In the controller, I test for the presence of the practice_name attribute, and if it's there, create a new Practice before assigning the practice to the User.

       if( params[:practice_name] )
         practice = Practice.create({:name => params['practice_name']})
         params[:user][:practice_id] = practice.id
       end
       # regular save/update here

This gets you a "combo-box", where you can choose, or add new, in one interface "slot".

Walter