This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This widget requires jQuery-iMask to run | |
| #https://github.com/cwolves/jQuery-iMask | |
| from gluon.dal import Field | |
| import re | |
| def factory(mask='', auto_start=True, empty_chr="_", error_message="Did not match!"): | |
| assert len(mask)>1, 'empty mask not is allowed' | |
| assert len(empty_chr)==1, 'empty_chr requires one character' | |
| from gluon.sqlhtml import StringWidget | |
| from gluon.validators import IS_MATCH, IS_NOT_EMPTY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add a trigger on field "custom_field1" | |
| cur_frm.cscript.custom_field1 = function(doc, cdt, cdn) { | |
| // update a new field "custom_field3" | |
| doc.custom_field3 = flt(doc.custom_field1)*flt(doc.custom_field2)/1000; | |
| // refresh in form | |
| refresh_field('custom_field3'); | |
| } |
NewerOlder