Welcome Guest, Not a member yet? Register   Sign In
How is use of jQuery plugin validation to CodeIgniter?
#1

[eluser]SaSa[/eluser]
Hello all
How is use of jQuery plugin validation to CodeIgniter?
Link jQuery plugin validation => http://bassistance.de/jquery-plugins/jqu...alidation/
#2

[eluser]SPeed_FANat1c[/eluser]
There is nothing special. I used it with CI. Just include it in your view file and use it Wink Don't forget to validate data with php when submit.
#3

[eluser]SaSa[/eluser]
are you confident that this method works correctly?
Because I do not work
#4

[eluser]SPeed_FANat1c[/eluser]
Yeah, for me it worked ok. What exactly does not work for you?
#5

[eluser]SaSa[/eluser]
I use of demo marketo
Between the head tags put the following:
Code:
<?=js_asset('jquery.validate.js');?>
    $(document).ready(function(){
    $("#contactform").validate();
});
And according to the forms for the links
Code:
class = "required defaultInvalid url"
required for normal cases
Code:
class = "required"
But it does not work?
#6

[eluser]SPeed_FANat1c[/eluser]
Code:
<?=js_asset('jquery.validate.js');?>
    $(document).ready(function(){
    $("#contactform").validate();
});

you have to add validation rules and submit handler there. For example:

Code:
<?=js_asset('jquery.validate.js');?>
    $(document).ready(function(){
    $("#contactform").validate({

     submitHandler:function(form) {
        
         form.submit();

        },

      rules: {
           input_name: {
              required: true,
              maxlength: 100
              
            },
                   input_address: {
                required: true
              }
    });
});

Edit: and you need script tags.
#7

[eluser]SaSa[/eluser]
thank
I did not notice you mean?

my form:
Code:
<?= form_open('links/seeror'); ?>
    <br>&lt;input type ='text' name='title' maxlength='50' class="required" /&gt;&lt;/br>
    <br>&lt;input type ='text' name='ural' maxlength='50' class="required defaultInvalid url" dir ="ltr" /&gt;&lt;/br>
    <br>&lt;input type ='text' name='page_linkus' maxlength='50' class="required defaultInvalid url" dir ="ltr" /&gt;&lt;/br>
    <br>&lt;input type ='text' name='exposition' maxlength='50' class="required" /&gt;&lt;/br>
    <br>&lt;input type="submit" value="Submit" /&gt;
#8

[eluser]SPeed_FANat1c[/eluser]
I don't understand what do you want to ask.

In your form one of the fields name is 'title' and it is required. So you can make a rule for it this way:

Code:
title: {
           required: true
        }
#9

[eluser]SaSa[/eluser]
thank
I do this But it does not work
Code:
&lt;head&gt;
&lt;?=js_asset('jquery.validate.js');?&gt;
            [removed]
    $(document).ready(function(){
    $("#contactform").validate({

     submitHandler:function(form) {
        
         form.submit();

        },

      rules: {
           title: {
              required: true,              
            },
           ural: {
              required: true,              
            },
           page_linkus: {
              required: true,              
            },
           exposition: {
              required: true,              
            },
    });
});
[removed]
&lt;/head&gt;
#10

[eluser]SPeed_FANat1c[/eluser]
your form must have an id = "contactform"




Theme © iAndrew 2016 - Forum software by © MyBB