I hope you are doing well.
I was wondering that is there any way to validate front end validation using codeigniter?
Basically I want to validate client side & server side validation using codeingiter.
Let me know if there's any pretty library or something.
I have searched on Internet and end up here to ask experts. :)
Many Thanks,
Muhammad Ahsan Ali
here is CI library with example!
https://codeigniter.com/user_guide/libraries/form_validation.html
A video link to understand
https://www.youtube.com/watch?v=axtmWvdFdDk
to custom rules
https://arjunphp.com/custom-validation-rules-codeigniter/
Check out this Code to make Ajax serve side validation showing in Client side
Ajax Validation in Codeigniter using Ajax
Related
I am using Magento version 1.7.0.2 and have created a custom module, in which there is a form that allows user to pass information in to the database.
I need to validate user input and looking around Google all i can see is front-end validation tutorials, I assume magento has server side validation tools? Based on this assumption I had a look in mage/core/customer/block/form/register.php and mage/core/customer/helper/data.php but have been unable to find anything of help, am i looking in the wrong place?
I am aware Zend has some validation, and will use that if Magento has not got it's own/extended zend validation.
In short, does Magento have it's own validation apart from the javascript validation tools?
Magento uses Zend for validation, you can take a look inside Mage/Customer/Model/Customer.php at the method validate()
I am trying to learn backbone.js to make a web application.This is my first time with a javascript framework and I am fairly confused with some of the stuff.
I have been developing in codeigniter for a while so I do have a understanding of the MVC architecture.
My question is how do I get the data from the backbone.js front end to my codeigniter controller and save it in the database. for example to implement a simple login/register functionality with CI and backbone, how should I proceed. If anyone can guide me step step then that would be great or point me to the right resource. Thank you.
PS: I know that I have to implement a REST api with my codeigniter but I don't know how? so if someone can provide a basic controller example it'd be really helpful.
Here's a tutorial to use the API mentioned in the above reply (by the author of the library himself)
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
Im attempting one of my first web applications in PHP.
There is a text box a user inputs text and clicks send. When send is clicked or when they are typing I want it to give the user an error message if they are entering forbidden characters.
But I cant really see a way to do it effectively in PHP.
Can anyone tell me what programming language would be best for this and maybe links if that would help.
However, I do not want anyone to give me the complete code for this, otherwise there is no challenge in it for me.
Thanks guys
You can use Javascript (with or without jQuery) to realtime validation. Or you use PHP to a server-side validation with IF conditionals.
Javascript Validation Sample:
http://www.w3schools.com/js/js_form_validation.asp
-- EDIT --
I recommend you validate first in the Javascript and later in PHP, because with FireBug users can edit the Javascript validation script.
There are two kinds of validation you need to consider: client-side and server-side.
Client-side validation is when the browser checks the input and reports errors as the user types, or when they hit "submit". You will probably want to use Javascript for this.
Server-side validation is when the server checks the input after the browser has submitted it. You can check this in PHP (or whatever server-side language you want - Java, C# or whatever). Note that you must do server-side validation even if you also do client-side, because you can't trust the user to submit valid data. It's pretty easy to submit bad data even when client-side validation is in use.
You need to use JavaScript because it is a client side language and can detect changed as the user is typing and such.
I am working on grails project where I need to apply server side validations.
For client side validations I have created basic validation.js file which contains all the javascript functions.
Now what should be the ideal way to achieve the server side validation using Ajax, to achieve the validations like Record Duplication check.
Thanks in advance....
I'd recommend reversing your approach and using the Remote Constraints plugin: http://grails.org/plugin/remote-constraints
It lets you write your validation on the server side (as Domain class constraints) and then generate client side ajax validation so a message is shown when the user tabs off an input field.
cheers
Lee
I do it like this;
Create a controller with a method (closure) and call it using Ajax. It then returns map with a success false or true, and a optional msg. You than handle it in js code.
Generally, I don't like to post links to solutions but there is quite a bit of code involved so read my article here: http://groovy.dzone.com/articles/better-scaffolding-jquery-part-0
It will show you exactly how to do what you are wanting.
I am creating one application in .net MVC, in which I am using jQuery AJAX to post some data to server. The data posting is working fine, but I also need to upload one image along with the data. I have searched on stack over flow for similar question but they are not able to help me. I donot want to use flash to upload file, pure jquery solution will help me.
Using some solution I tried to post to server, but on server side I am not getting file data.
Please can some body tell me how to implement file upload in jQuery ajax?
Thanks
Ashwani
I think you're out of luck if you want ajax like uploading without flash. Due to security limitations javascript can't do all the things required. Off the top of my head i'd say your only other option will be to use an iframe to make it appear as thought it was an ajax post.
Why not use flash though? YUI Uploader is amazingly simple and works great!