Ticket #150 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Selection control formatting error

Reported by: jgou Owned by: mpo
Priority: minor Milestone: 0.3
Component: modules/kauri-forms Version: trunk
Keywords: Cc:

Description

If you use a selection-control, and allow it to have multple selections (@multple=true), you get an error when you deselect everything. The 'formatting error' doens't disappear until the page is refreshed, even when you select something afterwards.

Change History

comment:1 Changed 4 years ago by jgou

The error is thrown in control.js 'Control.prototype.valueEquals' method, where the argument is 'undefined'.
Adding

if (thatValue == undefined)
  return false;

prevents the error.
I don't know if it is best to look deeper into this issue, but for now I suggest to add the above change - which is rather harmless.

comment:2 Changed 4 years ago by jgou

  • Milestone changed from 0.3 to 0.4

I applied the above patch in [933].
Issue stays open for possible further review, but this is not required for 0.3 .

comment:3 follow-up: ↓ 4 Changed 4 years ago by mpo

Hm, I think this changes the semantics of the valueEquals().

if (thatValue == undefined)

return thisValue == undefined

would keep things more aligned, but most probably will re-introduce your error, since that just doubles the first step of $.valueCompare()

Could you elaborate on the error that was thrown, and assess that valueChanged really is the location causing it?

comment:4 in reply to: ↑ 3 ; follow-up: ↓ 5 Changed 4 years ago by jgou

Replying to mpo:

Hm, I think this changes the semantics of the valueEquals().

if (thatValue == undefined)

return thisValue == undefined

would keep things more aligned, but most probably will re-introduce your error, since that just doubles the first step of $.valueCompare()

Could you elaborate on the error that was thrown, and assess that valueChanged really is the location causing it?

The method $.valueCompare(1, undefined) throws "TypeError: b is undefined" (which is later on displayed as a Formatting error), because it only checks for the second argument being undefined when the first is.

"if (thatValue == undefined)

return thisValue == undefined"

does therefore not re-introduce the error.

comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6 Changed 4 years ago by jgou

Replying to jgou:

Replying to mpo:

Hm, I think this changes the semantics of the valueEquals().

if (thatValue == undefined)

return thisValue == undefined

would keep things more aligned, but most probably will re-introduce your error, since that just doubles the first step of $.valueCompare()

Could you elaborate on the error that was thrown, and assess that valueChanged really is the location causing it?

The method $.valueCompare(1, undefined) throws "TypeError: b is undefined" (which is later on displayed as a Formatting error), because it only checks for the second argument being undefined when the first is.

"if (thatValue == undefined)

return thisValue == undefined"

does therefore not re-introduce the error.


I just found out that valueCompare is a kauri function (in core.js) and not a jQuery function, so I guess we better patch that method instead:

if (b == undefined)

return (a == undefined);

comment:6 in reply to: ↑ 5 Changed 4 years ago by mpo

Replying to jgou:

I just found out that valueCompare is a kauri function (in core.js) and not a jQuery function, so I guess we better patch that method instead:

if (b == undefined)

return (a == undefined);

Yep, I think patch [955] does what we want.
Please checkout, confirm and close.

comment:7 Changed 4 years ago by jgou

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from 0.4 to 0.3

issue fixed in [955]

Note: See TracTickets for help on using tickets.