Welcome Guest | Login

<%= link_if_authorized submit_tag(' '), {:action => ' '} %> is not working on I.E.

Hi there,

I want to create a user and I have written the below code in new.rhtml file which is present in /app/views/user folder

<%= start_form_tag( {:action => 'new'}, {:class => 'appform'}) %>
     
     <label>User Name:<input type="text" name="user[login]" /></label>

     <input type="submit" name="create" value="Create" />
     <%= link_if_authorized submit_tag('Cancel'), {:action => 'list'}  %>
     <%= link_if_authorized submit_tag('User List'), {:action => 'list'}  %>

<%= end_form_tag %>

This code is working fine on Firefox but its not working on IE.

What problem I am facing on IE is that when I am clicking on Create button I am able to create user but if I am clicking on Cancel or User List button it's not redirecting me to the list page(<%= link_if_authorized submit_tag('Cancel'), {:action => 'list'}  %>) but its asking me to enter user name that means it's calling the new function(<%= start_form_tag( {:action => 'new'}, {:class => 'appform'}) %>) not list function(<%= link_if_authorized submit_tag('Cancel'), {:action => 'list'}  %>).

Any help would be aprecciated.
~D

2007-11-03 06:09 AM

Website
Blog
I would suggest trying it without using link_if_authorized -- just use

<%= link_to.... if @authorized -%>
<%= link_to.... if @authorized -%>

where you setup @authorized accordingly.  Personally I'm not a fan of link_to, so another way you can do it is:

<% if @authorized -%>
 
 <a href="/controller/action">text</a>
 <a href="/controller/action">text</a>

<% end -%>

you get the idea....

2007-11-03 10:20 AM

Thanx William,

Your point is valid here but I want to make buttons not links.

Any help would be aprecciated.
~D

2007-11-04 07:58 AM

Website
Blog
Ahh - sorry I missed that.  Instead of <a href="... just put the <input type=button onClick=....

I hope that helps.  

2007-11-04 01:46 PM

Yeah, that will work.

Thanx a lot William

2007-11-04 10:46 PM

Website
Blog

Hello Guest! In order to post you must be an active client with us, please log in or sign up today!