How to trigger form's element validations before proceed with ajax or js event

hiikung

New Member
Hi,
I try to create a search form and some js script (x.js created in js folder) with the apply button. So my question is how to trigger the form validation such like notempty or notlessthan. Here by I attach my screen shot.

1. I disable the form submition using the code:
form.result = false;

2. after that I apply the the apply button click event:

$("button[name='apply']").click(function () {

if (Validation Passsed){
proceed with my code rendering the result
}
else
{
don't proceed
}
})
 

Attachments

  • screencapture.png
    screencapture.png
    14.6 KB · Views: 74
With ajax validation the validation is triggered as soon the element loses focus.
If this is not working on your site check for JS errors in your browser console.
For more JS see WIKI, e.g. http://fabrikar.com/forums/index.php?wiki/form-javascript-objects/

Are you using standard a Fabrik form template (e.g. bootstrap) and a standard Joomla template (like Protostar)?
Fabrik is relying on Joomla's standard JS.
 
Last edited:
yes. i am using standard Joomla template - Protostar. There is no js error in my console.

I just wondering how can I trigger the validation and grab it's result as following:

if (Validation result){
proceed with my code rendering the result
}
 
Your title says "Trigger the validation..." but it seems you want to do something AFTER the validation (of multiple elements?) was sucessful.
The validation is triggered on submit (Submit or Apply button).

To do something after submitting you can use form php plugins or the redirect plugin (only with "Submit", "Apply" is redirecting to the form)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top