jQuery: The Write Less, Do More JavaScript Library

Tabs and forms - Can this be done?

View: New views
2 Messages — Rating Filter:   Alert me  

Tabs and forms - Can this be done?

by Renobird :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello,

This may be a rudimentary question - I'm new to Jquery.

I'm using UI/Tabs successfully - http://docs.jquery.com/UI/Tabs

I have a contact form in one of the tabs...and I'd like the form to
get submitted via ajax and return a response from from the server in
the same tab.

Can this be done easily?

Any pointers would be greatly appreciated.

Thanks!
--
Tom

Re: Tabs and forms - Can this be done?

by Klaus Hartl-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Check out the jquery form plugin, it makes ajaxifying forms a no-
brainer, be it in a tab panel or elsewhere. All you have to to is
specify the target where the response should go and attach the
behavior to the form.

Say your form is inside a tab panel and you want to replace the whole
panel content with the response:

var $form = $('#your-form');
$form.ajaxForm({ target: $form.parents('.ui-tabs-panel') });

http://www.malsup.com/jquery/form/


--Klaus


On May 13, 4:55 pm, Renobird <t...@...> wrote:

> Hello,
>
> This may be a rudimentary question - I'm new to Jquery.
>
> I'm using UI/Tabs successfully -http://docs.jquery.com/UI/Tabs
>
> I have a contact form in one of the tabs...and I'd like the form to
> get submitted via ajax and return a response from from the server in
> the same tab.
>
> Can this be done easily?
>
> Any pointers would be greatly appreciated.
>
> Thanks!
> --
> Tom