hi

 here is my form fields

          <tr>
                <td><%= text_field  :title, :name =>
'external_link[title][]' %></td>
                <td><%= text_field  :url, :name => 'external_link[url]
[]' %></td>
            </tr>
            <tr>
                <td><%= link_to_function 'Add', "add();" %></td>

if i click add link there will be added 2 more text fields as above

in the controller iam using like

 def create
          puts params[:external_link][:title].inspect
      params[:external_link][:title].each_with_index do |l, i|
        ExternalLink.create!({:title => l, :url => params[:external_link]
[:url][i], :label => params[:label]})
      end
      redirect url(:external_links)
  end

in the model i have specified as

validates_presence_of :title, :url


the problem is when i submit the the form with out entering any
details its not checking validation
its giving error like

Validation failed: Title can't be blank, Url can't be blank


how can i do that in the controller and model

badly i need a help in this its urgent and imp.....


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to