Discussion:
[Vtigercrm-developers] vtiger 6.5: Examples of using Validation Engine without using button type="submit"?
Alan Lord
2017-01-10 14:01:44 UTC
Permalink
I have quite a complex custom view/page in vtiger where I need the
client to populate some fields then click on a button.

When they click on the button the Validation engine runs and the results
are displayed in a Popup window if the Validation is good.

However, the only way I can get the Validation to run is to have the
button as type="submit". This then ends up triggering a page reload on
the original page which I do not want. I have tried various

form.submit(function(e) {
e.preventDefault();
});

and trying to

return false;

from the event handler but nothing seems to work.

Can anyone think of any examples in the vtiger codebase where the
Validation Engine is being used, but without using a button of type
submit that I can review for a cluebat?

Cheers

Al




_______________________________________________
http://www.vtiger.com/
Mariusz Krzaczkowski
2017-01-10 14:53:07 UTC
Permalink
Hi Alan,
use the validationEngine('validate') function, it returns true or false.
Just be careful because it works once while validating, then it returns
null.
Here's an example of using it after clicking on a normal button:
https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/layouts/basic/modules/Vtiger/resources/List.js#L64
Here's the description:
https://github.com/posabsolute/jQuery-Validation-Engine#actions

---
Z powaÅŒaniem / Regards

MARIUSZ KRZACZKOWSKI
_Director of Product Development_
M: +48 884-998-123
E: ***@yetiforce.com
-------------------------

YetiForce 3.0 LTS has arrived! Test [1] the latest, most innovative open
source system in the world, and join [2] our community.
I have quite a complex custom view/page in vtiger where I need the client to populate some fields then click on a button.
When they click on the button the Validation engine runs and the results are displayed in a Popup window if the Validation is good.
However, the only way I can get the Validation to run is to have the button as type="submit". This then ends up triggering a page reload on the original page which I do not want. I have tried various
form.submit(function(e) {
e.preventDefault();
});
and trying to
return false;
from the event handler but nothing seems to work.
Can anyone think of any examples in the vtiger codebase where the Validation Engine is being used, but without using a button of type submit that I can review for a cluebat?
Cheers
Al
_______________________________________________
http://www.vtiger.com/
Links:
------
[1] https://gitdeveloper.yetiforce.com/
[2] https://github.com/YetiForceCompany/YetiForceCRM
Alan Lord
2017-01-10 15:27:08 UTC
Permalink
Awesome,

Thanks Mariusz!

Al
Post by Mariusz Krzaczkowski
Hi Alan,
use the validationEngine('validate') function, it returns true or false.
Just be careful because it works once while validating, then it returns
null.
Here's an example of using it after clicking on a normal
button: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/layouts/basic/modules/Vtiger/resources/List.js#L64
Here's the
description: https://github.com/posabsolute/jQuery-Validation-Engine#actions
---
Z poważaniem / Regards
*Mariusz Krzaczkowski*
_______________________________________

Loading...