I have igMaskEditor in mvc, I need when change combo the igMaskEditor change the input mask I use javascript for that but i cant do this
Control
@(Html.Infragistics().MaskEditorFor(m => m.Cliente)
.ID("txtIdentificacion").Render())
I tried change the input mask
$("#txtIdentificacion").igMaskEditor('option', 'inputMask', mascara);
Error
This option can not be set runtime
Please help me
Hello.
You need to see what is the exact ID that the Editor wrapper has rendered and you need to use it, in order to recreate the widget on the client. I'm using the following sample. You can see that the Mask editor on the page has the ID "ContactPhoneEditor". Then you can use that id and recreate the widget, using the following code:
$("#recreate").click(function() { var $editor = $("#ContactPhoneEditor"); var options = $editor.data("igMaskEditor").options; var value = $editor.igMaskEditor("value"); $editor.igMaskEditor("destroy"); options.inputMask = "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"; options.value = value; $editor.igMaskEditor(options);});
This is working fine and you can successfully submit mask editor value back to the server. If you need additional assistance, don't hesitate to ask.
Best regards,
Nikolay Alipiev
Software Developer
Hello,
I experienced the same issue after upgrading to 15.2 using javascript to reset the inputMask of the igMaskEditor then following your advice to recreate the control I encountered another problem;
When I execute the $('#txtMaskText').igMaskEditor('destroy'); method I receive an error: Sys.ParameterCountException: Parameter count mismatch.
Can you please point me into the right direction or maybe I am misunderstand you advice to "recreate" the control?
My code;
$("#txtMaskText").igMaskEditor({ width: 160, inputMask: "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC", nullText: "Enter Value"});
error trace;
"Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch.\n at String$trim (http://localhost:57120/ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQsgs2fQprVMCTtj3BeNLkmNYZ3YEny0GLMh0bRNHLHKwsqJyE9TGAEocHbZnDkNp4WJNZTnw9vfv2T16EPgttPFq0sGI_9O9T9LTMfhMS5jYTICPCSSDrqVf9JXRdQ4WwbErzevELwsgTn_j2jNnI4w1&t=ffffffff88e65ea0:500:33)\n at _removeAttributes (http://localhost:57120/IgniteUI_1502_cust/infragistics.js:356:7359)\n at Anonymous function (http://localhost:57120/Scripts/jquery-ui-1.10.4.min.js:6:4985)\n at _restoreDOMStructure (http://localhost:57120/IgniteUI_1502_cust/infragistics.js:356:6762)\n at Anonymous function (http://localhost:57120/Scripts/jquery-ui-1.10.4.min.js:6:4985)\n at destroy (http://localhost:57120/IgniteUI_1502_cust/infragistics.js:356:11973)\n at Anonymous function (http://localhost:57120/Scripts/jquery-ui-1.10.4.min.js:6:4985)\n at Anonymous function (http://localhost:57120/Scripts/jquery-ui-1.10.4.min.js:6:5940)\n at each (http://localhost:57120/Scripts/jquery-2.1.0.min.js:2:2870)\n at o.prototype.each (http://localhost:57120/Scripts/jquery-2.1.0.min.js:2:809)"
Regards,
Nathan
$('#txtMaskText').igMaskEditor('destroy');
This option cannot be changed at runtime, by design, and the error says that. You need to recreate the control in order to change the option value.