Solved

PHP & Ajax, YUI tab problem, tabView / DOM

Posted on 2007-03-27
4
681 Views
Last Modified: 2008-01-09
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
Comment
Question by:kkarumu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 18804911
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
 
LVL 1

Author Comment

by:kkarumu
ID: 18819951
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
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19539298
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question