Re: form handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxx> wrote:

>
>
> Chris Stinemetz <chrisstinemetz@xxxxxxxxx> 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
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux