Re: form handling
| From: | jean-baptiste verrey | Date: | Fri, 12 Aug 2011 11:45:04 +0000 |
| Subject: | Re: form handling | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314512@lists.php.net to get a copy of this message | ||
it's (pretty) easy to send two forms at once with jquery nowadays, you just
get all the input of the 2 forms and post them!
function submit2Forms(form1DomId,form2DomId){
$datas={};
$(form1DomId).find(':input').each(function(){
if(($(this).attr('name') &&
$(this).attr('type')!='checkbox') ||
($(this).attr('type')=='checkbox' &&
$(this).is(':checked')))
$datas[$(this).attr('name')]=$(this).val();
});
$(form2DomId).find(':input').each(function(){
if(($(this).attr('name') &&
$(this).attr('type')!='checkbox') ||
($(this).attr('type')=='checkbox' &&
$(this).is(':checked')))
$datas[$(this).attr('name')]=$(this).val();
});
$.post(URL,function(html) {
$('body').html(html);
})
return false;
});
it's just a small example so you can see how you can do it!
On 12 August 2011 08:48, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote:
>
>
> Chris Stinemetz <chrisstinemetz@gmail.com> wrote:
>
> >>
> >> I would bet it's the quotes screwing up the js. Can / are you
> >escaping that variable when ajaxing it back?
> >>
> >> Bastien Koert
> >> 905-904-0334
> >>
> >
> >I found a way to make the ajax work with one form. I removed the table
> >and the ajax worked just fine. Aparently you can't embed div
> >containers within a table without affecting the whole table. At least
> >that is what I found out tonight. Please correct me if I am wrong.
> >
> >Chris
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
> Without seeing your code, its hard to figure out what is happening. Post it
> onto pastebin or something (large code excerpts are very hard to read on
> this mailing list). Often, running the code through validator.w3.org will
> find issues that are affecting your layout.
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>