• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 690
  • Last Modified:

PHP & Ajax, YUI tab problem, tabView / DOM

PHP & Ajax, tabView / DOM

I am using YUI's tabView for creating tabs. The content of the tabs are made with PEAR's Flexy. A tab may consist of several select boxes, text fields and check boxes for instance, where the options in the select boxes has been set by the class handling the template system.

The problem occurs when I want to add new tabs. The content in the new tabs should be the same as in the first one. I've tried using innerHTML, but it doesn't seem to work (or I haven't understood it properly). So I wonder if using DOM and building the content dynamically with Javascript can do the magic? I need a way for setting the different select boxes etc. in the tabs, with unique IDs/names. I also need a way for the template class to get the new tabs. Any idèas?
0
kkarumu
Asked:
kkarumu
1 Solution
 
Mark GilbertSenior Performance EngineerCommented:
Hi Kkarumu, whilst I haven't tried YUI's tabview, I have played around with ajax, and have achieved some pretty remarkable results.  As you are using php, and are getting to grips with ajax, may I please recommend that you look at xajax:

http://www.xajaxproject.org

With a tab, what I would imagine is that you would query your database, and instead of doing a row per record, you would do a column per record.  So simply setup a function in xajax that is used to query the database, create some html which creates your tabs, using a <td> loop instead of a <tr> loop, and get your tabs dynamically generated.  You will find that with this logic, and the ease of using xajax, you can update your divs without any diffs at all.  I was personally really surprised as how easy it was to use.

There are other options such as limiting your tabs per row depending on column counts.  Such as 5 columns, then start a new row, while the tabs are created with embedded tables to ensure a kind of consistancy.  This obviously takes a little trial and error, however you may find this link useful:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_21697147.html
0
 
kkarumuAuthor Commented:
Thanx for your comment, the main problem was that the same fields on all tabs had the same id, I solved it by sending id og the tab to php and add that to the fields.
0
 
Computer101Commented:
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now