Hi friends, please help me.... my template is: view.rhtml <form action="/a/create"> <div id="first"> <div><input type="text" name="empfirstname"/></div> <div><input type="text" name="emplastname"/></div> </div> <div id="second"> <div><input type="text" name="empfirstname"/></div> <div><input type="text" name="emplastname"/></div> </div> </form> My controller is.... def create @firstname=params[:empfirstname] @lastname=params[:emplastname] @contacts = Contactbook.get :firstname => @firstname, :lastname => @lastname end Enter <div id="first"> this div only working But.... Second <div id="first"> not working Get only first div datas only.... please help me... Thanks. -- 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 Nov 14, 9:39 am, Smarty 2k <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Enter <div id="first"> this div only working > > But.... Second <div id="first"> not working > > Get only first div datas only.... > please help me...That''s what rails does if two inputs have the same name: it only uses the first one (unless the name ends with [], in which case you''ll get an array with all the values). Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
function switchEmailLogin(vendor) {
if(vendor=="first") {
document.getElementById(''second'').style.display =
"none";
document.getElementById(''first'').style.display = "";
}
else if(vendor=="second") {
document.getElementById(''first'').style.display =
"none";
document.getElementById(''second'').style.display =
"";
}
}
same else4
error....
undefined method `downcase'' for ["aaaaa", "aaaa",
""]:Array
That''s what rails does if two inputs have the same name: it only uses
the first one (unless the name ends with [], in which case you''ll get
an array with all the values).
Fred
--
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
-~----------~----~----~----~------~----~------~--~---
please help me....
my template is:
view.rhtml
<script>
function switchLogin(vendor) {
if(vendor=="first") {
document.getElementById(''second'').style.display =
"none";
document.getElementById(''first'').style.display = "";
}
else if(vendor=="second") {
document.getElementById(''first'').style.display =
"none";
document.getElementById(''second'').style.display =
"";
}
}
</script>
<li><a href="#"><img src="../images/a.gif"
title="First"
onclick="switchLogin(''first'');"/></a></li>
<li><a href="#"><img src="../images/b.gif"
border="0" title="Second"
onclick="switchLogin(''second'');"/></a></li>
<form action="/a/create">
<div id="first">
<div><input type="text"
name="empfirstname"/></div>
<div><input type="text"
name="emplastname"/></div>
</div>
<div id="second">
<div><input type="text"
name="empfirstname"/></div>
<div><input type="text"
name="emplastname"/></div>
</div>
</form>
My controller is....
def create
@firstname=params[:empfirstname]
@lastname=params[:emplastname]
@contacts = Contactbook.get :firstname => @firstname, :lastname =>
@lastname
end
Enter <div id="first"> this div only working
But.... Second <div id="first"> not working
Not get values in second div
please help me.....
or
<form action="/a/create">
<div id="first">
<div><input type="text"
name="empfirstname[]"/></div>
<div><input type="text"
name="emplastname[]"/></div>
</div>
<div id="second">
<div><input type="text"
name="empfirstname[]"/></div>
<div><input type="text"
name="emplastname[]"/></div>
</div>
</form>
Through Error undefined method `downcase'' for ["aaaaa",
"aaaa",
""]:Array
--
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 14 Nov 2008, at 10:13, Smarty 2k wrote:> > Enter <div id="first"> this div only working > > But.... Second <div id="first"> not working > > Not get values in second div > > please help me..... > > or > > <form action="/a/create"> > <div id="first"> > <div><input type="text" name="empfirstname[]"/></div> > <div><input type="text" name="emplastname[]"/></div> > </div> > <div id="second"> > <div><input type="text" name="empfirstname[]"/></div> > <div><input type="text" name="emplastname[]"/></div> > </div> > </form> > Through Error undefined method `downcase'' for ["aaaaa", "aaaa", > ""]:ArrayIf you do this then params[:empfirstname] will be an array so you need to handle it appropriately. I have no idea what you are doing but it may be more appropriate to just disabled the inputs when you hide their containing div. Fred> > -- > 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 -~----------~----~----~----~------~----~------~--~---