CI & extjs |
[eluser]Unknown[/eluser]
Hi all, been lurking for a while, reading, learning and testing things out. I have been playing with ci for some time now, on & off. I mainly program in VFP and have been trying to branch out to php. I have also played with javascript a bit, but not much at all. So the problem I have is that. I am trying to learn extjs within ci. I can create a form onto the browser, but my question is once I fill in the form and hit the submit button, how do I get that information into ci to be used? Any help would be greatly appreciated Thanks Ron
[eluser]Randy Casburn[/eluser]
Hi Ron, If you've been reading and playing, you know your [front] controller should be the "action" in your form. So your form should be "posting" to some url that matches a CI URI scheme. Inside that controller you'll need to set up some validation routines to sanitize your data from the form. You can go to the User Guide and read step-by-step instructions on how to do that. HERE: http://ellislab.com/codeigniter/user-gui...ation.html Once you've validated your data, it will be available for you to work with further. (put into DB or whatever). Randy
[eluser]Randy Casburn[/eluser]
By the way, I fully integrate ExtJS with CI. There are plenty of ideas on how to do create that perfect beast and I have my own. I can certainly give you some pointers. I need to make it clear that I have no intention of giving you code though but I'll help where I can. I suspect the next question will be "how do send my async response back to my frontend" -- so start searching for json_encode() if you're not already doing it ;-). Have fun, Randy
[eluser]indocoder[/eluser]
I dont know if it helps you or not... but the default submiting form extjs is GET, use POST instead if you stay to use prety url which CI provide
[eluser]Randy Casburn[/eluser]
Good point indocoder. Here it is from the ExtJs docs: Quote:method : String Thanks for point that out. I always send parameters with my ajax calls since it is part of my secuity checks, hence my calls are always POST'd, so I don't even think of this anymore. Randy [edit] that looks really weird the way it pasted in from the other site - it simply says: if you do nothing it defaults to undefined and will eventually end up a "GET" at your server. If you set parameters with your AJAX request, it will automatically turn your request into a "POST". [end edit]
[eluser]Unknown[/eluser]
Code: // Default method is POST The snippet above overrides the default connection settings, so when you e.g. create a new JsonStore you don't have to care about seting those values. Helps to keep your code a little more tidy. Just paste it somewhere early in you javascript code and you're good to go.
[eluser]symbol.software[/eluser]
THANKS FOR THIS INFO - WAS VERY USEFUL FOR ME. I'm new to CODEINGNITER but experienced IN Extjs. Good Post ! |
Welcome Guest, Not a member yet? Register Sign In |