I want to create text box but in run time when I write in the controller for @a="input type =''text'' " and in the view <%=@a%> it display text box in the page when it run but when I write in the controller for @a="<%=text_field%>" and in the view <%=@a%> it doesn''t display text box in the page when it run how can i solve it --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There are two problems with that. One, all that''s going to do is output the text "text_field" not call the method. Second, text_field requires two arguments object_name and method. So anyway, use the send method to call the text_field method in the view and pass in whatever args you need. # Controller @a = ''text_field'' # View <%= send(@a, :object_name, :method) %> Hope that helps. -- Josh http://iammrjoshua.com mahmoud_cs wrote:> I want to create text box but in run time > > when I write in the controller for @a="input type =''text'' " > and in the view <%=@a%> it display text box in the page when it run > > but when I write in the controller for @a="<%=text_field%>" > and in the view <%=@a%> it doesn''t display text box in the page when > it run > > how can i solve it-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 15, 2:31 am, Joshua Abbott <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> There are two problems with that. One, all that''s going to do is output > the text "text_field" not call the method. Second, text_field requires > two arguments object_name and method. > > So anyway, use the send method to call the text_field method in the view > and pass in whatever args you need. > > # Controller > @a = ''text_field'' > > # View > <%= send(@a, :object_name, :method) %> > > Hope that helps. > > -- Joshhttp://iammrjoshua.com >unfortunately it didn''t work it display that error undefined method ` text_field '' --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
text_field_tag See: http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html On Dec 15, 12:52 pm, mahmoud_cs <mahmoudahmedfo...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> On Dec 15, 2:31 am, Joshua Abbott <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > > > There are two problems with that. One, all that''s going to do is output > > the text "text_field" not call the method. Second, text_field requires > > two arguments object_name and method. > > > So anyway, use the send method to call the text_field method in the view > > and pass in whatever args you need. > > > # Controller > > @a = ''text_field'' > > > # View > > <%= send(@a, :object_name, :method) %> > > > Hope that helps. > > > -- Joshhttp://iammrjoshua.com > > unfortunately it didn''t work > it display that error undefined method ` text_field ''--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html style="direction: ltr;"> <head> <meta content="text/html;charset=windows-1256" http-equiv="Content-Type"> </head> <body style="direction: ltr;" bgcolor="#ffffff" text="#000000"> <p style="margin-bottom: 0cm; margin-top: 0pt;"><font face="Helvetica, Arial, sans-serif">How about creating a hidden DIV that include the text box, and make it appears programatically.</font><br> </p> <div class="moz-signature"> <title></title> <div class="moz-signature"> <div class="moz-signature"><br> <p style="margin-bottom: 0cm; margin-top: 0pt;"><font face="Arial">Regards,...</font></p> <p style="margin-bottom: 0cm; margin-top: 0pt;"><br> </p> <p style="margin-bottom: 0cm; margin-top: 0pt;"><font face="Arial"><b><big>Ahmed Abdelsalam</big></b></font> </p> </div> </div> </div> <p style="margin-bottom: 0cm; margin-top: 0pt;"><br> <br> hyuan wrote:<br> </p> <blockquote cite="mid:0134d79a-de05-4100-a8bc-6e9d5c01140c-HQS6uiv2oBMKR3bDO0DsXGB/v6IoIuQB4b8TPpkIZ3Q@public.gmane.orgcom" type="cite"> <pre wrap="">text_field_tag See: <a class="moz-txt-link-freetext" href="http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html">http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html</a> On Dec 15, 12:52 pm, mahmoud_cs <a class="moz-txt-link-rfc2396E" href="mailto:mahmoudahmedfo...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org"><mahmoudahmedfo...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org></a> wrote: </pre> <blockquote type="cite"> <pre wrap="">On Dec 15, 2:31 am, Joshua Abbott <a class="moz-txt-link-rfc2396E" href="mailto:rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org"><rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org></a> wrote: </pre> <blockquote type="cite"> <pre wrap="">There are two problems with that. One, all that''s going to do is output the text "text_field" not call the method. Second, text_field requires two arguments object_name and method. </pre> </blockquote> <blockquote type="cite"> <pre wrap="">So anyway, use the send method to call the text_field method in the view and pass in whatever args you need. </pre> </blockquote> <blockquote type="cite"> <pre wrap=""># Controller @a = ''text_field'' </pre> </blockquote> <blockquote type="cite"> <pre wrap=""># View <%= send(@a, :object_name, :method) %> </pre> </blockquote> <blockquote type="cite"> <pre wrap="">Hope that helps. </pre> </blockquote> <blockquote type="cite"> <pre wrap="">-- Joshhttp://iammrjoshua.com </pre> </blockquote> <pre wrap="">unfortunately it didn''t work it display that error undefined method ` text_field '' </pre> </blockquote> <pre wrap=""><!----> </pre> </blockquote> <br> --~--~---------~--~----~------------~-------~--~----~<br> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. <br> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <br> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en<br> -~----------~----~----~----~------~----~------~--~---<br> </body> </html> <br>