Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to have a TextItem with mask transfer constant mask value?

    Hi Isomorphic,

    please see this modified testcase (v12.0p_2019-01-25).

    If you enter some value in SKU, e.g. "1234567890" and hit the "Save"-button, this very string is sent to the server, not "(123) 456-7890". Is there some way to have these fixed characters like "(", " ", ")" and "," transferred as well?

    Reason behind this: We are querying the user for some zip code. Now different countries have different zip code formats, e.g. all zip codes in Luxembourg start with "L-" and all zip codes in Sweden look like "xxx xx".
    I want the user to enter the zip code in the country's format (already ensured by a validator), but also want to help him, not just with hint.
    For Luxembourg, I could pre-fill the item with "L-", but this does not work for Sweden or the sample here, where the constants are in the middle of the text
    So my question is: Is there some way to have the TextItem send the masked value instead of just the entered characters?

    Code:
    isc.DynamicForm.create({ 
        ID: "dynamicForm",
        dataSource: "supplyItem",
        // pre-fill some values
        values: {
            unitCost: 1.34,
            itemName: "My item",
            category: "My item's category"
        },
        fields: [
            {name: "itemID"},
            {name: "itemName"},
            {name: "SKU", mask: "(###) ###-####", hint: "(###) ###-####", showHintInField: true},
            {name: "category"},
            {name: "units"},
            {name: "unitCost"},
            {name: "inStock"},
            {name: "nextShipment"}
        ]
    });
    
    isc.IButton.create({
        ID: "saveButton",
        title: "Save",
        click: "dynamicForm.saveData()"
    });
    
    
    isc.IButton.create({
        ID: "clearErrorsButton",
        title: "Clear Errors",
        click: "dynamicForm.clearErrors(true)"
    });
    
    isc.IButton.create({
        ID: "disableValidationButton",
        autoFit: true,
        title: "Disable Validation",
        click: function () {
            dynamicForm.disableValidation = !dynamicForm.disableValidation;
            this.setTitle((dynamicForm.disableValidation ? "Enable" : "Disable")+" Validation");
        }
    });
    
    isc.HStack.create({
        ID: "buttons",
        height: 24,
        membersMargin: 10,
        members: [saveButton, clearErrorsButton, disableValidationButton]    
    });
    
    isc.VLayout.create({
        membersMargin: 10,
        members: [dynamicForm, buttons]
    });
    Thank you & Best regards
    Blama

    #2
    Set maskSaveLiterals:true on the field.

    Comment


      #3
      Hi Isomorphic,

      thanks, that was an easy one and I don't know how it missed it.

      Best regards
      Blama

      Comment

      Working...
      X