Ticket #339 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

setWireValue(...,true) sets fields valid instead of unvalidated

Reported by: sdm Owned by: freya
Priority: major Milestone: 0.4
Component: modules/kauri-forms Version: trunk
Keywords: Cc: kauri-discuss@…

Description

A call to setWireValue() with the second parameter (noValidation) set to true, sets fields valid (or in case an invalid value was passed in the setWireValue: invalid), even though the second parameter says not to validate yet, and the fields should remain unvalidated.

For example: if your form config has a field "name" with a required validator, and you initialise the form, the "name" field doesn't have the 'valid' nor the 'invalid' class (=normal behaviour). If you then call setWireValue({},true), the "name" field will have the 'valid' class, but when you try to submit the form, the field gets the 'invalid' class.

Change History

comment:1 Changed 3 years ago by freya

Hello,

I'm not sure if I understand the problem.
Example: basic-form1 in the samples.

                  'name':  {
                      base: 'string',
                      '+validators': { 'required': {} },
                      label: "name"
                  },
                  'email': {
                      base: 'string',
                      '+validators': { 'isEmail': {} },
                      label: "e-mail"
                  }

basicForm.setWireValue({
            "email":"geenvalidemail"
          }, true);

Then there is no validation done in setWireValue, and the class set to the input fields is "valid". When submitting the form, validation is done en class is set to 'invalid'.

When done

basicForm.setWireValue({
            "email":"geenvalidemail"
          }, false);

everything is immediately validated and the classes are set to invalid.

comment:2 Changed 3 years ago by freya

OK it's about the valid/invalid class that shouldn't even be there when there was no validation, of course.

solved in r1567. can you check your case, stephanie?

comment:3 Changed 3 years ago by sdm

Now it's working almost completely: setWireValue doesn't add 'valid' or 'invalid' class attributes anymore when noValidation=true, so this is good.

But I've noticed that the case-control still has the valid class after initialisation of the form. You can also see this in the forms-sample, page advanced-controls: the selection-list of the case-control where you can choose between "phone" and "email", has the 'valid' class after initialisation of the form.

comment:4 Changed 3 years ago by freya

  • Status changed from new to closed
  • Resolution set to fixed

comment:5 Changed 3 years ago by sdm

  • Status changed from closed to reopened
  • Resolution fixed deleted

The case-control still has the valid class after initialisation of the form.

comment:6 Changed 3 years ago by freya

  • Owner changed from mpo to freya
  • Status changed from reopened to assigned

comment:7 follow-up: ↓ 8 Changed 3 years ago by freya

please verify in r1580

comment:8 in reply to: ↑ 7 Changed 3 years ago by sdm

The case-control works as expected now, but I've seen that the dblselect-control still gets the valid/invalid class when calling setWireValue(...,true). You can check this in the dblselect sample.

comment:9 Changed 3 years ago by freya

  • Status changed from assigned to closed
  • Resolution set to fixed

dblSelect should be OK now, dblselect was not yet using the "novalidation" argument. see r1587.

Note: See TracTickets for help on using tickets.