Page 1 of 1

AJAX, tab interface and FORMS

Posted: Mon Jan 21, 2008 6:46 am
by VladSun
I participated in one project - web-based application for integrating CRM with a call-center (Asterisk based). It's extremely AJAX based with tab interface. I made a Javascript framework for it by using jQuery, but I faced a problem with targeting FORMs:
by submitting a form, there are optionally several tabs to be refreshed. So, I added hidden fields in every form like these:

Code: Select all

 <input type='hidden' class='tabControl' name='refresh' value='tab_name_goes_here' disabled='1'><input type='hidden' class='tabControl' name='close' value='tab_name_goes_here' disabled='1'><input type='hidden' class='tabControl' name='open' value='tab_name_goes_here' disabled='1'> 
i.e. the name parameter is for "action", and the value parameter is for "tab target". The default FORM submit is cancelled, but instead an AJAX POST is performed.

I wonder whether some of you have been facing this problem and what solutions do you have?

Re: AJAX, tab interface and FORMS

Posted: Mon Jan 21, 2008 12:22 pm
by pickle
I'm not 100% sure on what you're asking. Do you want a way to reload the appropriate tab after a form is submitted?

Re: AJAX, tab interface and FORMS

Posted: Tue Jan 22, 2008 2:30 am
by VladSun
Let's have an example:
There is a tab containing the users list - "User list". There is a button "Add user" in this tab. When submitting the form containing this button, a new tab "Add user" is opened and focused. This new tab has its own form for filling the information and when it is submitted there are two actions to be executed - the response of is targeted to this "Add user" (i.e. successful or not) and at the same time the "User list" tab is refreshed. Supposing we have successfully created an user, there is an "OK" button, which when clicked performs two actions - closes the current "Add user" tab and focuses the "User list" tab.

PS: You can always select and view any tab, any time ...

Re: AJAX, tab interface and FORMS

Posted: Tue Jan 22, 2008 9:45 am
by pickle
So...you want to be able to somehow know which tabs to refresh (via AJAX) based on which button was pressed?

Re: AJAX, tab interface and FORMS

Posted: Tue Jan 22, 2008 10:13 am
by VladSun
No :)
I have solved it in the way I described.
I just want to know if there is somebody that faced this problem and how did he solve it.