Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method to validate single field #393

Closed
robhicks opened this issue Jun 6, 2012 · 16 comments
Closed

method to validate single field #393

robhicks opened this issue Jun 6, 2012 · 16 comments

Comments

@robhicks
Copy link

robhicks commented Jun 6, 2012

Is there a method to validate a single field?

Here's a real world scenario. A user profie editor. The user can add as many email address as the user wants. One of them needs to be the default email address for the user. The user is presented with a link to make an email address the default email address. When the link is clicked, the email address field needs to be validated. It is not important to validate the rest of the form. In fact, it clutters up the screen.

@orefalo
Copy link
Collaborator

orefalo commented Jun 6, 2012

yes validate, please read the documentation

@orefalo orefalo closed this as completed Jun 6, 2012
@robhicks
Copy link
Author

robhicks commented Jun 6, 2012

Validate validates the entire form, not a single field.

On Wed, Jun 6, 2012 at 9:50 AM, Olivier Refalo <
reply@reply.github.com

wrote:

yes validate, please read the documentation


Reply to this email directly or view it on GitHub:

#393 (comment)

@orefalo
Copy link
Collaborator

orefalo commented Jun 6, 2012

it doesn't, get the master - it's in the doc

// field validation
alert( $("#emailInput").validationEngine('validate') );

cheers

@robhicks
Copy link
Author

robhicks commented Jun 6, 2012

My bad.

But I still can't get it to work right.

My field validation (email address field), uses required, custom[email],
and ajax[isEmailUnique].

validate returns immediately before the server responds so:

alert($(this).parent().parent().find('.email').validationEngine('validate'));

always returns false.

Is a callback available for the validate method?

On Wed, Jun 6, 2012 at 9:55 AM, Olivier Refalo <
reply@reply.github.com

wrote:

it doesn't, get the master - it's in the doc


Reply to this email directly or view it on GitHub:

#393 (comment)

@orefalo
Copy link
Collaborator

orefalo commented Jun 6, 2012

yes, its in options. please read the doc

@robhicks
Copy link
Author

robhicks commented Jun 6, 2012

I'm trying to understand the doc.

I have loaded validationEngine after the dom has loaded:

$('#personalProfile').validationEngine({ajaxFormValidation: true});

Then when I want to validate a single email field:

$(this).parent().parent().find('.email').validationEngine('validate',
{
ajaxFormValidationURL: "ajaxIsEmailUnique",
onAjaxFormComplete: function(status, form, errors, options){
alert(status);
}
}
);

The ajax request is sent to the server (but only as a result of entry in
validationEngine-en.js) and the response returns. But the callback never
fires.

Can options only be added with 'init' or 'attach'?

On Wed, Jun 6, 2012 at 10:37 AM, Olivier Refalo <
reply@reply.github.com

wrote:

yes, its in options. please read the doc


Reply to this email directly or view it on GitHub:

#393 (comment)

@lubnashaikh
Copy link

$("#date").parent().validationEngine('showPrompt', '*date field is required');
i use it for single field validate hope it "ll help

@omairrazam
Copy link

this post is old but i can see that answer to Robhicks issue has not been given. i had faced the same issue and had spent alot of time finding its solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may be php file or in codeigniter a function, that function must return an array of data, that data is the posted that of the form, we need to make an array of this data and then return it... this data is then passed to callback function and in your case form is the parameter that contains this data.... here is my that post function which i wrote as per my requirement this is codeigniter function
public function ajax_valid_main() {

    /**
     * *********************************
     * this function is used for server side validation
     * this is required by Validation Engine
     * Validation Engine code is post method...
     * so this function is used to return something
     * for validation engine to work
     * *********************************
     */
    $from = "";
    $to = "";

    if (isset ( $_POST ['search_by'] )) {
        $search_by = $_POST ['search_by'];
    }

    if ($search_by == "" && ! isset ( $search_by )) {
        $result = array ('status' => 0 );
        echo json_encode ( $result );
        return;
    }

    $result = array ('search_by' => $search_by );

    if (isset ( $_POST ['s_uname'] )) {
        $name = $_POST ['s_uname'];
        $name = escape_quotes ( $name );
        $result = array_merge ( $result, array ('s_uname' => $name ) );
        $result = array_merge ( $result, array ('key' => $name ) );
    }
    if (isset ( $_POST ['s_uid'] )) {

        $uid = $_POST ['s_uid'];
        $uid = escape_quotes ( $uid );
        $result = array_merge ( $result, array ('s_uid' => $uid ) );
        $result = array_merge ( $result, array ('key' => $uid ) );
    }
    if (isset ( $_POST ['s_email'] )) {
        $email = $_POST ['s_email'];
        $email = escape_quotes ( $email );
        $result = array_merge ( $result, array ('s_email' => $email ) );
        $result = array_merge ( $result, array ('key' => $email ) );
    }

    echo json_encode ( $result );
}

i guess if we just return an empty json array it will still work or may be we dont need to return anthing but just existance of this function is necessary.... this is subject to hit and trial.
i hope this will help :)

@lubnashaikh
Copy link

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam notifications@github.com
wrote:

this post is old but i can see that answer to Robhicks issue has not been
given. i had faced the same issue and had spent alot of time finding its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may be php file
or in codeigniter a function, that function must return an array of data,
that data is the posted that of the form, we need to make an array of this
data and then return it... this data is then passed to callback function
and in your case form is the parameter that contains this data.... here is
my that post function which i wrote as per my requirement this is
codeigniter function
public function ajax_valid_main() {

/**
 * *********************************
 * this function is used for server side validation
 * this is required by Validation Engine
 * Validation Engine code is post method...
 * so this function is used to return something
 * for validation engine to work
 * *********************************
 */
$from = "";
$to = "";

if (isset ( $_POST ['search_by'] )) {
    $search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
    $result = array ('status' => 0 );
    echo json_encode ( $result );
    return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
    $name = $_POST ['s_uname'];
    $name = escape_quotes ( $name );
    $result = array_merge ( $result, array ('s_uname' => $name ) );
    $result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

    $uid = $_POST ['s_uid'];
    $uid = escape_quotes ( $uid );
    $result = array_merge ( $result, array ('s_uid' => $uid ) );
    $result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
    $email = $_POST ['s_email'];
    $email = escape_quotes ( $email );
    $result = array_merge ( $result, array ('s_email' => $email ) );
    $result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );

}

i guess if we just return an empty json array it will still work.... this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
#393 (comment)
.

@omairrazam
Copy link

lols… i just replied on a forum … There was an issue discussed a few years back but no one replied the correct solution. so thought although post is too old but may be in future my answer might help someone.
On Jan 31, 2015, at 11:15 PM, lubnashaikh notifications@github.com wrote:

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam notifications@github.com
wrote:

this post is old but i can see that answer to Robhicks issue has not been
given. i had faced the same issue and had spent alot of time finding its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may be php file
or in codeigniter a function, that function must return an array of data,
that data is the posted that of the form, we need to make an array of this
data and then return it... this data is then passed to callback function
and in your case form is the parameter that contains this data.... here is
my that post function which i wrote as per my requirement this is
codeigniter function
public function ajax_valid_main() {

/**


  • this function is used for server side validation
  • this is required by Validation Engine
  • Validation Engine code is post method...
  • so this function is used to return something
  • for validation engine to work
    * *********************************
    */
    $from = "";
    $to = "";

if (isset ( $_POST ['search_by'] )) {
$search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
$result = array ('status' => 0 );
echo json_encode ( $result );
return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
$name = $_POST ['s_uname'];
$name = escape_quotes ( $name );
$result = array_merge ( $result, array ('s_uname' => $name ) );
$result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

$uid = $_POST ['s_uid'];
$uid = escape_quotes ( $uid );
$result = array_merge ( $result, array ('s_uid' => $uid ) );
$result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
$email = $_POST ['s_email'];
$email = escape_quotes ( $email );
$result = array_merge ( $result, array ('s_email' => $email ) );
$result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );
}

i guess if we just return an empty json array it will still work.... this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
#393 (comment)
.


Reply to this email directly or view it on GitHub.

@lubnashaikh
Copy link

heheheh ok

On Sun, Feb 1, 2015 at 6:02 AM, omairrazam notifications@github.com wrote:

lols… i just replied on a forum … There was an issue discussed a few years
back but no one replied the correct solution. so thought although post is
too old but may be in future my answer might help someone.
On Jan 31, 2015, at 11:15 PM, lubnashaikh notifications@github.com
wrote:

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam notifications@github.com
wrote:

this post is old but i can see that answer to Robhicks issue has not
been
given. i had faced the same issue and had spent alot of time finding
its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may be php
file
or in codeigniter a function, that function must return an array of
data,
that data is the posted that of the form, we need to make an array of
this
data and then return it... this data is then passed to callback
function
and in your case form is the parameter that contains this data....
here is
my that post function which i wrote as per my requirement this is
codeigniter function
public function ajax_valid_main() {

/**


  • this function is used for server side validation
  • this is required by Validation Engine
  • Validation Engine code is post method...
  • so this function is used to return something
  • for validation engine to work
    * *********************************
    */
    $from = "";
    $to = "";

if (isset ( $_POST ['search_by'] )) {
$search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
$result = array ('status' => 0 );
echo json_encode ( $result );
return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
$name = $_POST ['s_uname'];
$name = escape_quotes ( $name );
$result = array_merge ( $result, array ('s_uname' => $name ) );
$result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

$uid = $_POST ['s_uid'];
$uid = escape_quotes ( $uid );
$result = array_merge ( $result, array ('s_uid' => $uid ) );
$result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
$email = $_POST ['s_email'];
$email = escape_quotes ( $email );
$result = array_merge ( $result, array ('s_email' => $email ) );
$result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );
}

i guess if we just return an empty json array it will still work....
this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
<
https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72302901>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#393 (comment)
.

@omairrazam
Copy link

hehehhee
On Feb 2, 2015, at 2:16 PM, lubnashaikh notifications@github.com wrote:

heheheh ok

On Sun, Feb 1, 2015 at 6:02 AM, omairrazam notifications@github.com wrote:

lols… i just replied on a forum … There was an issue discussed a few years
back but no one replied the correct solution. so thought although post is
too old but may be in future my answer might help someone.
On Jan 31, 2015, at 11:15 PM, lubnashaikh notifications@github.com
wrote:

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam notifications@github.com
wrote:

this post is old but i can see that answer to Robhicks issue has not
been
given. i had faced the same issue and had spent alot of time finding
its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may be php
file
or in codeigniter a function, that function must return an array of
data,
that data is the posted that of the form, we need to make an array of
this
data and then return it... this data is then passed to callback
function
and in your case form is the parameter that contains this data....
here is
my that post function which i wrote as per my requirement this is
codeigniter function
public function ajax_valid_main() {

/**


  • this function is used for server side validation
  • this is required by Validation Engine
  • Validation Engine code is post method...
  • so this function is used to return something
  • for validation engine to work
    * *********************************
    */
    $from = "";
    $to = "";

if (isset ( $_POST ['search_by'] )) {
$search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
$result = array ('status' => 0 );
echo json_encode ( $result );
return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
$name = $_POST ['s_uname'];
$name = escape_quotes ( $name );
$result = array_merge ( $result, array ('s_uname' => $name ) );
$result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

$uid = $_POST ['s_uid'];
$uid = escape_quotes ( $uid );
$result = array_merge ( $result, array ('s_uid' => $uid ) );
$result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
$email = $_POST ['s_email'];
$email = escape_quotes ( $email );
$result = array_merge ( $result, array ('s_email' => $email ) );
$result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );
}

i guess if we just return an empty json array it will still work....
this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
<
https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72302901>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#393 (comment)
.


Reply to this email directly or view it on GitHub.

@lubnashaikh
Copy link

are u facing problm in validation of single field?

On Mon, Feb 2, 2015 at 6:23 PM, omairrazam notifications@github.com wrote:

hehehhee
On Feb 2, 2015, at 2:16 PM, lubnashaikh notifications@github.com wrote:

heheheh ok

On Sun, Feb 1, 2015 at 6:02 AM, omairrazam notifications@github.com
wrote:

lols… i just replied on a forum … There was an issue discussed a few
years
back but no one replied the correct solution. so thought although post
is
too old but may be in future my answer might help someone.
On Jan 31, 2015, at 11:15 PM, lubnashaikh notifications@github.com
wrote:

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam <
notifications@github.com>
wrote:

this post is old but i can see that answer to Robhicks issue has
not
been
given. i had faced the same issue and had spent alot of time
finding
its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may be
php
file
or in codeigniter a function, that function must return an array
of
data,
that data is the posted that of the form, we need to make an array
of
this
data and then return it... this data is then passed to callback
function
and in your case form is the parameter that contains this data....
here is
my that post function which i wrote as per my requirement this is
codeigniter function
public function ajax_valid_main() {

/**


  • this function is used for server side validation
  • this is required by Validation Engine
  • Validation Engine code is post method...
  • so this function is used to return something
  • for validation engine to work
    * *********************************
    */
    $from = "";
    $to = "";

if (isset ( $_POST ['search_by'] )) {
$search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
$result = array ('status' => 0 );
echo json_encode ( $result );
return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
$name = $_POST ['s_uname'];
$name = escape_quotes ( $name );
$result = array_merge ( $result, array ('s_uname' => $name ) );
$result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

$uid = $_POST ['s_uid'];
$uid = escape_quotes ( $uid );
$result = array_merge ( $result, array ('s_uid' => $uid ) );
$result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
$email = $_POST ['s_email'];
$email = escape_quotes ( $email );
$result = array_merge ( $result, array ('s_email' => $email ) );
$result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );
}

i guess if we just return an empty json array it will still
work....
this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
<

https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72302901>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
<
https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72345602>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#393 (comment)
.

@omairrazam
Copy link

yes
On Feb 2, 2015, at 7:53 PM, lubnashaikh notifications@github.com wrote:

are u facing problm in validation of single field?

On Mon, Feb 2, 2015 at 6:23 PM, omairrazam notifications@github.com wrote:

hehehhee
On Feb 2, 2015, at 2:16 PM, lubnashaikh notifications@github.com wrote:

heheheh ok

On Sun, Feb 1, 2015 at 6:02 AM, omairrazam notifications@github.com
wrote:

lols… i just replied on a forum … There was an issue discussed a few
years
back but no one replied the correct solution. so thought although post
is
too old but may be in future my answer might help someone.
On Jan 31, 2015, at 11:15 PM, lubnashaikh notifications@github.com
wrote:

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam <
notifications@github.com>
wrote:

this post is old but i can see that answer to Robhicks issue has
not
been
given. i had faced the same issue and had spent alot of time
finding
its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may be
php
file
or in codeigniter a function, that function must return an array
of
data,
that data is the posted that of the form, we need to make an array
of
this
data and then return it... this data is then passed to callback
function
and in your case form is the parameter that contains this data....
here is
my that post function which i wrote as per my requirement this is
codeigniter function
public function ajax_valid_main() {

/**


  • this function is used for server side validation
  • this is required by Validation Engine
  • Validation Engine code is post method...
  • so this function is used to return something
  • for validation engine to work
    * *********************************
    */
    $from = "";
    $to = "";

if (isset ( $_POST ['search_by'] )) {
$search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
$result = array ('status' => 0 );
echo json_encode ( $result );
return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
$name = $_POST ['s_uname'];
$name = escape_quotes ( $name );
$result = array_merge ( $result, array ('s_uname' => $name ) );
$result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

$uid = $_POST ['s_uid'];
$uid = escape_quotes ( $uid );
$result = array_merge ( $result, array ('s_uid' => $uid ) );
$result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
$email = $_POST ['s_email'];
$email = escape_quotes ( $email );
$result = array_merge ( $result, array ('s_email' => $email ) );
$result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );
}

i guess if we just return an empty json array it will still
work....
this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
<

https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72302901>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
<
https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72345602>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#393 (comment)
.


Reply to this email directly or view it on GitHub.

@lubnashaikh
Copy link

i also had same problm.tdz y post solution.didn't it help u?

On Mon, Feb 2, 2015 at 9:54 PM, omairrazam notifications@github.com wrote:

yes
On Feb 2, 2015, at 7:53 PM, lubnashaikh notifications@github.com wrote:

are u facing problm in validation of single field?

On Mon, Feb 2, 2015 at 6:23 PM, omairrazam notifications@github.com
wrote:

hehehhee
On Feb 2, 2015, at 2:16 PM, lubnashaikh notifications@github.com
wrote:

heheheh ok

On Sun, Feb 1, 2015 at 6:02 AM, omairrazam notifications@github.com

wrote:

lols… i just replied on a forum … There was an issue discussed a
few
years
back but no one replied the correct solution. so thought although
post
is
too old but may be in future my answer might help someone.
On Jan 31, 2015, at 11:15 PM, lubnashaikh <
notifications@github.com>
wrote:

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam <
notifications@github.com>
wrote:

this post is old but i can see that answer to Robhicks issue
has
not
been
given. i had faced the same issue and had spent alot of time
finding
its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may
be
php
file
or in codeigniter a function, that function must return an
array
of
data,
that data is the posted that of the form, we need to make an
array
of
this
data and then return it... this data is then passed to
callback
function
and in your case form is the parameter that contains this
data....
here is
my that post function which i wrote as per my requirement this
is
codeigniter function
public function ajax_valid_main() {

/**


  • this function is used for server side validation
  • this is required by Validation Engine
  • Validation Engine code is post method...
  • so this function is used to return something
  • for validation engine to work
    * *********************************
    */
    $from = "";
    $to = "";

if (isset ( $_POST ['search_by'] )) {
$search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
$result = array ('status' => 0 );
echo json_encode ( $result );
return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
$name = $_POST ['s_uname'];
$name = escape_quotes ( $name );
$result = array_merge ( $result, array ('s_uname' => $name )
);
$result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

$uid = $_POST ['s_uid'];
$uid = escape_quotes ( $uid );
$result = array_merge ( $result, array ('s_uid' => $uid ) );
$result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
$email = $_POST ['s_email'];
$email = escape_quotes ( $email );
$result = array_merge ( $result, array ('s_email' => $email )
);
$result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );
}

i guess if we just return an empty json array it will still
work....
this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
<

https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72302901>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
<

https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72345602>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
<
https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72456948>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#393 (comment)
.

@omairrazam
Copy link

actually my issue was little different…. i understand validation engine a lot well now but i was using it with jtable and was having issues while using asynchronous ajax calls.
you can help me only if you have some experience with jtable. issue is:
in normal case for asynchronous ajax calls all data is returned to our callback function where we then submit the form but in jtable it has its own event handler like for for submission and i was trying to apply asynchronous ajax field
validation on its form at client side but when i wrote the syntax of asynchronous call in jtable form submitting handler, there was some map-functioning..

when i was brought to your form, my issue was not stated there but there was a person's issue that was not answered and i knew the solution, so i posted my solution there.

On Feb 3, 2015, at 10:00 PM, lubnashaikh notifications@github.com wrote:

i also had same problm.tdz y post solution.didn't it help u?

On Mon, Feb 2, 2015 at 9:54 PM, omairrazam notifications@github.com wrote:

yes
On Feb 2, 2015, at 7:53 PM, lubnashaikh notifications@github.com wrote:

are u facing problm in validation of single field?

On Mon, Feb 2, 2015 at 6:23 PM, omairrazam notifications@github.com
wrote:

hehehhee
On Feb 2, 2015, at 2:16 PM, lubnashaikh notifications@github.com
wrote:

heheheh ok

On Sun, Feb 1, 2015 at 6:02 AM, omairrazam notifications@github.com

wrote:

lols… i just replied on a forum … There was an issue discussed a
few
years
back but no one replied the correct solution. so thought although
post
is
too old but may be in future my answer might help someone.
On Jan 31, 2015, at 11:15 PM, lubnashaikh <
notifications@github.com>
wrote:

why u send it 2 me???

On Sat, Jan 31, 2015 at 8:42 AM, omairrazam <
notifications@github.com>
wrote:

this post is old but i can see that answer to Robhicks issue
has
not
been
given. i had faced the same issue and had spent alot of time
finding
its
solution.
issue : callback is not firing
there is a path where form submits( i.e form Post field), may
be
php
file
or in codeigniter a function, that function must return an
array
of
data,
that data is the posted that of the form, we need to make an
array
of
this
data and then return it... this data is then passed to
callback
function
and in your case form is the parameter that contains this
data....
here is
my that post function which i wrote as per my requirement this
is
codeigniter function
public function ajax_valid_main() {

/**


  • this function is used for server side validation
  • this is required by Validation Engine
  • Validation Engine code is post method...
  • so this function is used to return something
  • for validation engine to work
    * *********************************
    */
    $from = "";
    $to = "";

if (isset ( $_POST ['search_by'] )) {
$search_by = $_POST ['search_by'];
}

if ($search_by == "" && ! isset ( $search_by )) {
$result = array ('status' => 0 );
echo json_encode ( $result );
return;
}

$result = array ('search_by' => $search_by );

if (isset ( $_POST ['s_uname'] )) {
$name = $_POST ['s_uname'];
$name = escape_quotes ( $name );
$result = array_merge ( $result, array ('s_uname' => $name )
);
$result = array_merge ( $result, array ('key' => $name ) );
}
if (isset ( $_POST ['s_uid'] )) {

$uid = $_POST ['s_uid'];
$uid = escape_quotes ( $uid );
$result = array_merge ( $result, array ('s_uid' => $uid ) );
$result = array_merge ( $result, array ('key' => $uid ) );
}
if (isset ( $_POST ['s_email'] )) {
$email = $_POST ['s_email'];
$email = escape_quotes ( $email );
$result = array_merge ( $result, array ('s_email' => $email )
);
$result = array_merge ( $result, array ('key' => $email ) );
}

echo json_encode ( $result );
}

i guess if we just return an empty json array it will still
work....
this
is subject to hit and trial.
i hope this will help :)


Reply to this email directly or view it on GitHub
<

https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72302901>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
<

https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72345602>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
<
https://github.com/posabsolute/jQuery-Validation-Engine/issues/393#issuecomment-72456948>

.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#393 (comment)
.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants