What have I missed I have a .rhtml with the sandard form parameters <%= image_submit_tag("excel.gif", :alt => "Download List to Excel", :border => 0, :name => ''render_action'', :value => ''excel'' ) %> Which genenerates I believe a valid html fragment for a submit button. <input alt="Download List to Excel" border="0" name="render_action" src="/images/sapexcel.gif?1149227900" type="image" value="excel" /> BUT my controller doesnt pick up the value of params[:render_action] ? if params[:render_action].nil? render else mytext = render_to_string(:action => ''list_excel'', :layout => false) send_data mytext, :type => ''application/vnd.ms-excel'', :disposition => ''inline'' end It works if I create a standard check box tag Download Results to Excel:<%= check_box_tag ("render_action", value="excel" ) %> but I want it this to work as a check_box button. What am I doing wrong? -- Posted via http://www.ruby-forum.com/.
Why not create a hidden field to hold the value? -jwm Glenn Cadman wrote:> What have I missed > > I have a .rhtml with the sandard form parameters > > <%= image_submit_tag("excel.gif", :alt => "Download List to Excel", > :border => 0, :name => ''render_action'', :value => ''excel'' ) %> > > Which genenerates I believe a valid html fragment for a submit button. > > <input alt="Download List to Excel" border="0" name="render_action" > src="/images/sapexcel.gif?1149227900" type="image" value="excel" /> > > BUT my controller doesnt pick up the value of params[:render_action] ? > > if params[:render_action].nil? > render > else > mytext = render_to_string(:action => ''list_excel'', :layout => > false) > send_data mytext, :type => ''application/vnd.ms-excel'', > :disposition => ''inline'' > end > > It works if I create a standard check box tag > Download Results to Excel:<%= check_box_tag ("render_action", > value="excel" ) %> but I want it this to work as a check_box button. > > What am I doing wrong? > > >
Jonathon Marshall wrote:> Why not create a hidden field to hold the value? > > -jwmI actually want two submit buttons a) Standard submit button which just does a submit "View" b) Submit with "render_action" excel "View with Excel" If I have a hidden field with the render action then if the user clicks the standard button the hidden field value would result the render to excel whichever button is clicked. -- Posted via http://www.ruby-forum.com/.