# Submit button does not work

**URL:** <https://www.ruby-forum.com/t/submit-button-does-not-work/125579>\
**Category:** Rails\
**Created:** [January 10, 2008, 10:22am UTC](https://www.ruby-forum.com/t/submit-button-does-not-work/125579 "2008-01-10T10:22:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [January 10, 2008, 10:22am UTC](https://www.ruby-forum.com/t/submit-button-does-not-work/125579/1 "2008-01-10T10:22:08Z")

</div>

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 😕

---

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [January 10, 2008, 12:51pm UTC](https://www.ruby-forum.com/t/submit-button-does-not-work/125579/2 "2008-01-10T12:51:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [January 10, 2008, 2:12pm UTC](https://www.ruby-forum.com/t/submit-button-does-not-work/125579/3 "2008-01-10T14:12:37Z")

</div>

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.
