I want to know how can i send the values of form fields build dynamic with prototype. i have the form as follow: <form id="id" method="post" action="url"> <div id="dynamicFields"></div> </form> with prototype i fill the dynamicFields DIV with <input> and <select> tags, but when i submit the form the values of dynamic fields are not send. Renso Vargas
Robin Haswell
2006-Mar-09 18:31 UTC
Re: [prototype] how i send Dynamic form field values??
I''ve definitely made this work before, I think you should inspect your application closer for bugs. Got a demo? -Rob Renso Vargas wrote:> I want to know how can i send the values of form fields build dynamic > with prototype. > > i have the form as follow: > > <form id="id" method="post" action="url"> > <div id="dynamicFields"></div> > </form> > > > with prototype i fill the dynamicFields DIV with <input> and <select> > tags, but when i submit the form the values of dynamic fields are not > send. > > Renso Vargas > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I think that the input values need "names" Also check that you did not introduce a </form> On Mar 9, 2006, at 11:31 AM, Robin Haswell wrote:> I''ve definitely made this work before, I think you should inspect > your application closer for bugs. Got a demo? > > -Rob > > Renso Vargas wrote: >> I want to know how can i send the values of form fields build >> dynamic with prototype. >> i have the form as follow: >> <form id="id" method="post" action="url"> >> <div id="dynamicFields"></div> >> </form> >> with prototype i fill the dynamicFields DIV with <input> and >> <select> tags, but when i submit the form the values of dynamic >> fields are not send. >> Renso Vargas >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
On 3/9/06, Renso Vargas <rensovargas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> with prototype i fill the dynamicFields DIV with <input> and <select> > tags, but when i submit the form the values of dynamic fields are not send.I''d start by making sure that all of the fields you''re adding dynamically, that are meant to be submitted to a server later, have a name attribute. Todd
Jaimz
2006-Mar-17 00:54 UTC
Re: [Spam] Re: [prototype] how i send Dynamic form fieldvalues??
I originally submitted this as a guest on the forum interface to the mailing list. but i guess it never got OK''d... i''m having this same problem, all my form fields do have names and id''s and thier all differant names and so on. heres what i have 1.) autocomplete form that takes a company name from a database 2.) after something is selected from the autocomplete it calls a function that calls "Ajax.Updater" and gets some checkboxes that are made from a list of contacts 3.) that list of checkboxes is placed in a div that IS within the form tags 4.) i submit and show the $_POST vars (it''s php) and none of the checkboxes are there. heres what the check boxes look like when thier displayed by JS <div><label><input type=\"checkbox\" name=\"client_ids[]\" id=\"client_ids_350\" value=\"350" /><i>Contact Name</i></label></div> so everything is there. it''s just like the form won''t submit elements that were added to it''s structure AFTER the page was rendered. is there a way to make it "re-read" all the form elements, or is there a way to send the form and get the values from the ajax added checkboxes. i''m so lost! now i''m having even more problems where i have to submit up to 50 inputs that where created by JS. Todd Ross wrote:> On 3/9/06, Renso Vargas <rensovargas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> with prototype i fill the dynamicFields DIV with <input> and <select> >> tags, but when i submit the form the values of dynamic fields are not send. >> > > I''d start by making sure that all of the fields you''re adding > dynamically, that are meant to be submitted to a server later, have a > name attribute. > > Todd > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >
Todd Ross
2006-Mar-17 11:40 UTC
Re: [Spam] Re: [prototype] how i send Dynamic form fieldvalues??
On 3/16/06, Jaimz <jaimz-uIlgR+TDBxns2ve5o0e2fw@public.gmane.org> wrote:> so everything is there. it''s just like the form won''t submit elements > that were added to it''s structure AFTER the page was rendered.While that might appear to be the case, there''s probably another explanation. I see no reason why dynamic form elements that have been appended to the form (as opposed to the body, which you said you''re already doing -- good) and have name attributes shouldn''t be submitted to the server. I have a couple instances where I''m doing exactly that (although not with Prototype). Do you have a live example? It''s going to be your fastest (and, possibly only) route to a solution. Todd
Todd Ross wrote:> Do you have a live example? It''s going to be your fastest (and, > possibly only) route to a solution. > > Toddyeah here''s an example.. http://labs.gi-tools.com/hat_trick/ login info: username: demo password: demo once your logged in click on "Pick-Up Depot | Add a File" in the client code box you can try "FA" then choose "FAME" from the autocomplete. if you look at it right away it may be a little funky because i''m currently working on it right now (if you look at the JS) i''m tricking it to get all my form information from the JS created inputs, i have it so that (lets say you click on a check box) it will put the value into an array so that if you uncheck the checkbox it will remove it from the array, then after the array is processed it puts all the values of the checkboxes into a serialized string and makes that the value of a hidden input that''s not created by JS. this idea works great, IF i didn''t need a comments box, and all the lower checkboxes for EACH file that''s choosen for upload! if you submit you''ll see a var_dump() of the POST if you use the FF extenstion "Rendered source" you can see that my JS build the form as a 100% valid form, so i don''t know what the deal is. theres no JS errors or anything either. -- Posted via http://www.ruby-forum.com/.
> once your logged in click on "Pick-Up Depot | Add a File" > in the client code box you can try "FA" then choose "FAME" from the > autocomplete. > > if you look at it right away it may be a little funky because i''m > currently working on itEntering Client Code ''FA'' and then choosing the first FAME from the list gives me a Forbidden error. Is it in a state where you think it should be working? Todd
Todd Ross wrote:> Is it in a state where you think it should be working? > > Toddyeah you can check it out now, lol i feel like an idiot, i had put some JS that relies on php in a .JS file because i forgot the php was in the JS it works now -- Posted via http://www.ruby-forum.com/.
On 3/17/06, jaimz murray <jaimz-uIlgR+TDBxns2ve5o0e2fw@public.gmane.org> wrote:> yeah you can check it out now, lol i feel like an idiot, i had put some > JS that relies on php in a .JS file because i forgot the php was in the > JS > > it works nowSwap your <form> and <table> tags. A form isn''t a valid descendent of a table. <div id="18" class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <form action="index.php?page=pickup_send" id="myform" method="post"> <tr> Also, you never close your <form>. Todd
On 3/17/06, Todd Ross <rails-spinoffs-25kFIyuv2iRiLUuM0BA3LQ@public.gmane.org> wrote:> Swap your <form> and <table> tags. A form isn''t a valid descendent of a table.So, I saw that you updated the code ... array empty array ''client_code'' => ''FAME'' ''usr_ids'' => ''clients_ids[0]=2&clients_ids[1]=31'' ''file_ids'' => '''' ''textarea'' => '''' ''Submit'' => ''Submit'' ''client_ids_2'' => ''2'' ''client_ids_31'' => ''31'' Is that the result you were expecting, /including/ the dynamically generated elements? Todd
it sure does, i normally put the form tag inbetween the <table> and the <tr> because that will prevent that huge gap that''s created by the form at the bottom Todd Ross wrote:> On 3/17/06, Todd Ross <rails-spinoffs-25kFIyuv2iRiLUuM0BA3LQ@public.gmane.org> wrote: > >> Swap your <form> and <table> tags. A form isn''t a valid descendent of a table. >> > > So, I saw that you updated the code ... > > array > empty > > array > ''client_code'' => ''FAME'' > ''usr_ids'' => ''clients_ids[0]=2&clients_ids[1]=31'' > ''file_ids'' => '''' > ''textarea'' => '''' > ''Submit'' => ''Submit'' > ''client_ids_2'' => ''2'' > ''client_ids_31'' => ''31'' > > Is that the result you were expecting, /including/ the dynamically > generated elements? > > Todd > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >
Marco M. Jaeger
2006-Mar-18 19:30 UTC
RE: [Spam] Re: Re: Re: [prototype] how i send Dynamicform
To remove the gap, just use css like: form { margin: 0px; /* set margin to 0 because IE and Firefox have different default margins */ } -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jaimz Sent: Saturday, March 18, 2006 7:49 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Spam] Re: [Rails-spinoffs] Re: Re: [prototype] how i send Dynamicform it sure does, i normally put the form tag inbetween the <table> and the <tr> because that will prevent that huge gap that''s created by the form at the bottom Todd Ross wrote:> On 3/17/06, Todd Ross <rails-spinoffs-25kFIyuv2iRiLUuM0BA3LQ@public.gmane.org> wrote: > >> Swap your <form> and <table> tags. A form isn''t a valid descendent of atable.>> > > So, I saw that you updated the code ... > > array > empty > > array > ''client_code'' => ''FAME'' > ''usr_ids'' => ''clients_ids[0]=2&clients_ids[1]=31'' > ''file_ids'' => '''' > ''textarea'' => '''' > ''Submit'' => ''Submit'' > ''client_ids_2'' => ''2'' > ''client_ids_31'' => ''31'' > > Is that the result you were expecting, /including/ the dynamically > generated elements? > > Todd > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
good idea, i don''t know why i never thought of that :p DUH! haha thanks guys Marco M. Jaeger wrote:> To remove the gap, just use css like: > > form { > margin: 0px; /* set margin to 0 because IE and Firefox have > different default margins */ > } > > -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Jaimz > Sent: Saturday, March 18, 2006 7:49 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Spam] Re: [Rails-spinoffs] Re: Re: [prototype] how i send > Dynamicform > > it sure does, i normally put the form tag inbetween the <table> and the > <tr> because that will prevent that huge gap that''s created by the form > at the bottom > > Todd Ross wrote: > >> On 3/17/06, Todd Ross <rails-spinoffs-25kFIyuv2iRiLUuM0BA3LQ@public.gmane.org> wrote: >> >> >>> Swap your <form> and <table> tags. A form isn''t a valid descendent of a >>> > table. > >>> >>> >> So, I saw that you updated the code ... >> >> array >> empty >> >> array >> ''client_code'' => ''FAME'' >> ''usr_ids'' => ''clients_ids[0]=2&clients_ids[1]=31'' >> ''file_ids'' => '''' >> ''textarea'' => '''' >> ''Submit'' => ''Submit'' >> ''client_ids_2'' => ''2'' >> ''client_ids_31'' => ''31'' >> >> Is that the result you were expecting, /including/ the dynamically >> generated elements? >> >> Todd >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> >> >> >> > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > >