Welcome Guest, Not a member yet? Register   Sign In
Development Tactics
#1

[eluser]macleodjb[/eluser]
Hi Guys,

I have a couple of questions that i need some advice on a good method to take since upgrading to codeigniter.

1. If i have a form that needs to be validated, whats the best way to do it? I normally used javascript to validate prior to submittal, then php after that. I'm not quite sure how codeigniters validation works. How should i do it now?

2. Flash messages, how can i display them for instance if form validation fails or if an event happens that i want to report instead of using echo or print.

3. i have a website which required me to post a JOB_ID, or ITEM_ID in the query string and i used the query string to determine where i needed to go. What's the best practice for this method. I read a little something about using the URI but is that what i should do?
#2

[eluser]xzela[/eluser]
Hi,

1) To validate a form checkout the User Guide:
http://ellislab.com/codeigniter/user-gui...ation.html
It's pretty good and allows your to create your own custom validations using callbacks

2) I'm not sure what you mean by 'flash messages'. If you mean you wish to display an alert message before the form is submitted, you'll probably have to roll your own ajax/dHTML method. CodeIgniter is pretty flexible when it comes to creating your own functions so you'll pretty much have the power to do anything (within reason).

3) depending on how your database structure is setup you should be able to pass only the item_id to a controller function. Then use a model to access all of the data related to that item_id.

see: http://ellislab.com/codeigniter/user-gui...llers.html
#3

[eluser]macleodjb[/eluser]
I was looking at the flash data here about mid page.

http://ellislab.com/codeigniter/user-gui...html#flash

I guess i will have to mess around with the form validation and see how it works.

so in order to retrieve my JOB_ID i am going to have to code my URL like this http://www.example.com/view_job/1




Theme © iAndrew 2016 - Forum software by © MyBB