Welcome Guest, Not a member yet? Register   Sign In
Using tabbed style view in code igniter
#1

[eluser]stevefink[/eluser]
Hi all!

I'm excited to say that I decided to use code igniter as my framework for an auto site I'm putting together for a client. I've also got their permission to submit it to the projects tab when the site is completed.

I have a quick inquiry. I currently have tabs made using CSS where the user goes through a process of registering a vehicle. Once they fill out one tab, they're allowed to navigate to the next.

I'd like them to be able to accomplish this without refreshing the page, so I'm going to ultimately have to use some XmlHttpRequest in my javascript.

Would anyone be kind enough to give me insight on how to handle the control/view part of this code with code igniter? I'm guessing I'll need four different views for four tabs even though they're all going to be presented in the same page?

Thanks for any insight, can't wait to show you folks the final product.

- sf
#2

[eluser]Michael Wales[/eluser]
You'll either need 4 different views - or one view that is dynamically altered based on the information that is passed to the controller, the information found within the session, or the information found within the database (depending on your approach).

To coincide with the MVC thought-process, I'd have one controller - use the controller to determine which view to load - and then have your 4 different views.
#3

[eluser]stevefink[/eluser]
Thanks so much for the conceptual insight. The MVC approach you mention makes a great ordeal of sense. Perhaps I can use JQuery's .load() or .ajax() methods to load the views without a page refresh based on what is being handled.

Thanks again wales. I'm going to start coding it and see where I run into issues. :-)

- sf
#4

[eluser]Michael Wales[/eluser]
Yeah - just remember that your Ajax requests will be for the URL - meaning, your controller will be called which will in turn request the view. Plan accordingly.
#5

[eluser]Colin Williams[/eluser]
Quote:I’d like them to be able to accomplish this without refreshing the page

C'mon. Maximize your budget. Write less code. Debug less. Keep more users happy. There is NO need for Ajax here. None.
#6

[eluser]esra[/eluser]
Maybe some other alternatives... There is an dated article on phpriot.com by Quentin Zervaas about creating a multi-part form wizard. The difference between tabbed multi-part forms and a wizard is slight conceptually (i.e., just a different way of navigating through the form parts).

http://www.phpriot.com/d/articles/php/ap...index.html

For the EXT JS library which also handles tabs nicely, there are several user contributions for implementing a wizard based on tab panels and panes (somewhat similar in concept to the Microsoft C++ approach of implementing a wizard based on a hidden tab bar interface). Both examples display a dialog box with panels (which could also have been tab panels). The major difference is that buttons are used to navigate through the forms rather than tabs.

http://extjs.com/forum/showthread.php?t=...ght=wizard

http://extjs.com/forum/showthread.php?t=...ght=wizard

EXT JS has a lot of overhead and as Colin points out, wizard or tab interfaces can be created without using Ajax.
#7

[eluser]Colin Williams[/eluser]
Quote:wizard or tab interfaces can be created without using Ajax

Make that, wizard or tab interfaces should be created without using Ajax
#8

[eluser]stevefink[/eluser]
Thanks for the insight Colin and Esra. I've taken your expertise into consideration and also now think that adding the overhead of AJAX for this purpose is quite vanity and not required. I'm going to omit it from my design.

I *really* appreciate the URLs above and look forward to reading them prior to creating this multi-tab form.

Cheers all!

- sf
#9

[eluser]garymardell[/eluser]
Why not allow both?

You can write JS for the people who have it enabled but when its not enabled it can depreciate giving the standard urls.
#10

[eluser]alpar[/eluser]
i agree, ajax shouldn't be used, but just in case, and for the future, try xajax to work with, and you don't have to bother with the JS




Theme © iAndrew 2016 - Forum software by © MyBB