Welcome Guest, Not a member yet? Register   Sign In
How to Submit textarea comment on Enter key?
#7

[eluser]boltsabre[/eluser]
Quote:and my team members asked me to follow, so I had to do it.
Ah the powers that be! Tell them their idiots, that facebook "enter to submit" drives most users insane! Okay, don't tell them that their idiots, don't want to loose your job!

Firstly, is this a site that is 100% powered by javascript? Ie, if it's disabled all you see is a "please enable JS to use this site"?
If not, remember you'll still have to build the "standard" non-js submit form functionality. I'd get that up and going first.

Another couple of things

You're not doing ANY data cleansing of your review ID... people can change it to whatever they want using any number of browser plugins, you should:
1. Check that it is_numeric (at the very least)
2. Make a DB call (using active records so that it automatically escapes the data) and check at such a review does indeed exist
3. And if that all works, then proceed.
EDIT: Okay, on second thoughts, I cannot see your model, perhaps you're doing that check in there when your run the insert comment code. Either way, just make sure you've got some kind of check


Quote:Now the problem is I’m not sure how to pass the data from javascript to the Controller.
I'm a little confused... you're not actually submitting the form by JS yet... all you're current JS code does right now is submit the form (in the standard 'php' way) once the user presses enter.
You'll have to research "codeigniter and ajax" for this functionality.

Another thing, once you have your ajax up and going, you're doing your "did user enter anything" validation on the server, not sure if you have it in your view as well, but you should have this check on there as well if you're going to have ajax. Ajax calls are still a server hit, taking time, are prone to server connection issues, and adding extra load to your server. By doing this check client side first you're doing the right thing! (But you still want server side valiation for proper security.



Feel free to post back once you run into a specific problem.


Messages In This Thread
How to Submit textarea comment on Enter key? - by El Forum - 01-08-2013, 08:25 PM
How to Submit textarea comment on Enter key? - by El Forum - 01-08-2013, 11:16 PM
How to Submit textarea comment on Enter key? - by El Forum - 01-09-2013, 03:16 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-09-2013, 04:55 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-09-2013, 08:00 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-09-2013, 08:08 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-09-2013, 08:40 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-09-2013, 08:46 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-09-2013, 09:29 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-10-2013, 12:57 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-10-2013, 04:16 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-10-2013, 05:57 AM
How to Submit textarea comment on Enter key? - by El Forum - 01-10-2013, 09:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB