Submit button does not work

HI!
In my form rendered partially, for 3 models: User, Address, Phone.

The are if conditions in the form for handling user registration and
updating user.
When i do the registration part the submit button works but on the
edit it wont !!??

Heres the complete form:
manage.html.erb:

<%= error_messages_for ‘user’ %>
<% if params[:id].blank? -%>
<%form_for :user, :url=>{:action=>:register} do |form| %>
<%= render :partial=>‘form’, :locals => { :form => form }%>

<%= submit_tag "rejestruj"%> <%end%> <%else -%> <%form_for :user,@user, :url=>{ :action=>:update,:id=>@user.id} do | form| %> <%= render :partial=>'form', :locals => { :form => form }%> <% end %> <%= submit_tag "zmieñ" %> <%end%>

_form.html.erb

Dane systemowe: Login: <%=form.text_field :login,:size=>25 %>* Has³o: <%=form.password_field :password, :size=>30 %>* Powtórz has³o: <%=form.password_field :password_confirmation, :size=>30 %>* typ konta: <%if session[:user_level].to_i == 3 %> administrator: <%=form.radio_button :account_type, '3' %> <%end %> nauczyciel: <%=form.radio_button :account_type, '2' %> uczeñ: <%=form.radio_button :account_type, '1' %> Dane osobowe: Imie: <%=form.text_field :name, :size=>15 %>* Nazwisko: <%=form.text_field :surname, :size=>20 %>* Dane adresowe: <%if @user %> <%fields_for :address, @user.address do |a| %> <%=render :partial=>'address',:locals=>{:a => a} %> <%end %> <%else %> <%fields_for :address do |a| %> <%=render :partial=>'address',:locals=>{:a => a} %> <%end %> <%end %> <%if @user %> <%fields_for :phones, @user.phones[0] do |p| %> <%=render :partial=>'phones',:locals=>{:p => p} %> <%end %> <%else %> <%fields_for :phones do |p| %> <%=render :partial=>'phones',:locals=>{:p => p} %> <%end %> <%end %> Email: <%=form.text_field :email, :size=>55 %>* prywatna strona www: <%=form.text_field :home_page, :size=>75 %>

address.html.erb
Ulica:
<%= a.text_field :street, :size=>25%>

Numer:
<%= a.text_field :number, :size=>8%>

Miasto:
<%= a.text_field :city, :size=>30 %>

Kod pocztowy:
<%= a.text_field :post_code, :size=>17%>

Województwo:
<%= a.text_field :state, :size=>18 %>

Kraj:
<%= a.text_field :country, :size=>25 %>

_phones.html.erb
Telefon:
<%= p.select :phone_type,[‘domowy’,‘komórkowy’,‘biurowy’]%>

numer:
<%= p.text_field :number, :size=>19%>

And the action in the controller
def register
@user = User.new(params[:user])
@address = Address.new(params[:address])
@user.address = Address.new(params[:address]) #@address
@phone = Phone.new(params[:phones])
@user.phones << @phone
if request.post? and @user.save
flash[:notice] = "Zosta³e¶ zarejestrowany " + @user.login
redirect_to(:controller=>:main, :action =>:index)
else
render :action=>:manage
end
end

Other thing is that adding the addres to juser stoped working, after
adding another field :confused:

On 10 Jan 2008, at 09:21, Adam wrote:

HI!
In my form rendered partially, for 3 models: User, Address, Phone.

The are if conditions in the form for handling user registration and
updating user.
When i do the registration part the submit button works but on the
edit it wont !!??

What do you mean by not working? Does nothing happen when you click
the submit button, do you get an error message (if so what?), does
something happen that you weren’t expecting happen ?

Fred

It actually does nothing, no error message no submit action just like
you click lets say a regular image on page.
I’ve already tride to replace it with a regular html but still no effect, maybe its a rails bug or smth.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs