Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

validators crash when validate()

$
0
0
I'm using v9.0p_2014-01-24 pro, Safari 6.1.1. The example unexpectedly generates a console error.

Code:

var vm = isc.ValuesManager.create({});
isc.DynamicForm.create({
  valuesManager: vm,
  fields: [
      {
        type:"text",
        title:"Entry",
        defaultValue: "asdf",
        validators: [
            {type:"contains",substring:"/"}
        ]
      }
  ]
});

isc.Button.create({
  top:50,
  title:"Validate",
  click: function(){
      console.log("valid:",vm.validate());
  }
});

The default value is invalid (because it doesn't have a "/"), so I'd expect to see the form display an error when the button is clicked. Instead, the console gets the error:

Code:

[Error] TypeError: 'undefined' is not an object (evaluating '_2.contains')
        isc_Canvas_addValidationError (ISC_Core.js, line 2740)
        isc_Canvas_addValidationError (ISC_Core.js, line 2738)
        isc_DynamicForm_validate (ISC_Forms.js, line 430)
        isc_ValuesManager_validate (ISC_Forms.js, line 2073)
        click (test.js, line 21)
        isc_StatefulCanvas_handleActivate (ISC_Foundation.js, line 226)
        isc_StatefulCanvas_handleClick (ISC_Foundation.js, line 227)
        isc_c_EventHandler_bubbleEvent (ISC_Core.js, line 1269)
        isc_c_EventHandler_handleClick (ISC_Core.js, line 1145)
        isc_c_EventHandler__handleMouseUp (ISC_Core.js, line 1136)
        isc_c_EventHandler_handleMouseUp (ISC_Core.js, line 1128)
        isc_c_EventHandler_dispatch (ISC_Core.js, line 1302)
        anonymous


Viewing all articles
Browse latest Browse all 4756

Trending Articles