#13433 closed defect (fixed)
set regExp on running time
Reported by: | weezero | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | Dijit - Form | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
when i set the regExp on running time doesn´t seem to work equal of when i set the regExp on control´s creation, i mean, the result is the same but the control´s behaviour seems different.
i have these controls:
- ipt_tipo_telefono: FilteringSelect,
- ipt_codigo_area: ValidationTextBox and
- ipt_numero_telefono: ValidationTextBox (on this one i set the regExp according to the values of the other two)
On onChange event of the first two, execute this function:
function validarTelefono() { var codigo_area = dijit.byId("ipt_codigo_area").get("value"); var tipo_telefono = dijit.byId("ipt_tipo_telefono").get("value"); var ipt_numero_telefono = dijit.byId("ipt_numero_telefono"); if (tipo_telefono.substr(0,3)=="Par") { var long_telefono = 11 - codigo_area.length; ipt_numero_telefono.set("maxLength", long_telefono); ipt_numero_telefono.set("promptMessage",""); if (codigo_area=="011") { ipt_numero_telefono.set("regExp","\\b[3-6]\\d{" + (long_telefono - 1) + "}\\b"); } else { ipt_numero_telefono.set("regExp","\\b[4-5]\\d{" + (long_telefono - 1) + "}\\b"); } } else { if (tipo_telefono.substr(0,3)=="Cel") { var long_telefono = 13 - codigo_area.length; ipt_numero_telefono.set("maxLength", long_telefono); ipt_numero_telefono.set("promptMessage","No olvide anteponer el 15."); ipt_numero_telefono.set("regExp","\\b15[4-6][0-9]{" + (long_telefono - 3) + "}\\b"); } } }
Attachments (2)
Change History (8)
comment:1 Changed 10 years ago by
Component: | General → Dijit - Form |
---|---|
Description: | modified (diff) |
Owner: | set to Douglas Hays |
comment:2 Changed 10 years ago by
Milestone: | tbd → 1.8 |
---|
regexp needs a custom _set*Attr method to recompute the generated partialre value, but this is complicated by the regExpGen method which should be deprecated and combined with regExp since both cannot be specified. I'll target this for 1.8 for now. It should be possible to regen the partialre internal value by calling
widget.set('constraints', widget.get('constraints'));
Of course without a comment as to what bad thing is happening currently, this problem may or may not be fixed by this enhancement.
comment:3 Changed 10 years ago by
the expected behavior of the regExp is until you don´t type an invalid character, the control doesn´t marked as invalid, but when i set the regExp attribute on running time, the actual behavior is that the control shows an invalid state while you are typing (even if its valid) until you finish typing, then it marked as valid. i hope you understand me, pardon my english
Changed 9 years ago by
Attachment: | 13433.patch added |
---|
deprecate regExpGen and recompute the validating RE after regExp is changed
Changed 9 years ago by
Attachment: | 13433.2.patch added |
---|
deprecate regExp and regExpGen in favor of HTML5's pattern
You'll need to be more specific about what problem you are seeing (explaining the expected behavior vs. the actual behavior), and also attach a full test case (a single HTML file with instructions on how to run and reproduce the problem), thanks.