Ticket #763 (closed defect: fixed)

Opened 5 months ago

Last modified 4 months ago

QListBox with QSelectionMode::Multiple doesn't set type required for js escaping

Reported by: banetbi Owned by:
Priority: minor Milestone: 2.1
Component: QControls Version: 2.0 HEAD
Keywords: Cc:

Description

When using a QListBox with QSelectionType::Multiple in an AjaxAction? the following javascript error occurs:

strPostValue.replace is not a function /assets/_core/js/qcubed.js Line 196

upon further inspection this happens because qcubed.js is trying to escape the values. qcubed.js is looking for a type of select-multiple which is not being included in the GetAttributes? call of QListBoxBase.class.php

I was able to resolve the issue by overriding the GetAttributes? function with the following in QListBox.class.php

public function GetAttributes?($blnIncludeCustom = true, $blnIncludeAction = true) {

$strToReturn = parent::GetAttributes?($blnIncludeCustom, $blnIncludeAction);

if ($this->intRows)

$strToReturn .= sprintf('size="%s" ', $this->intRows);

if ($this->strSelectionMode == QSelectionMode::Multiple) {

$strToReturn .= 'multiple="multiple" ';

$strToReturn .= 'type="select-multiple" ';

}



return $strToReturn;

}

Attachments

ticket763.patch Download (439 bytes) - added by vakopian 4 months ago.

Change History

Changed 4 months ago by vakopian

Changed 4 months ago by vakopian

This has been broken by the move to jQuery, because $j(this).attr("type") does not return the type property of the DOM element (which is what was used prior to jQuery).
I don't think the proposed solution is the best solution since it would put a non-standard "type" attribute on the select tag.
It's much easier to fix qcubed.js.
Patch is attached, please test.

Changed 4 months ago by alex94040

  • status changed from new to in_QA

Good one, vakopian!

Changed 4 months ago by vakopian

  • status changed from in_QA to closed
  • resolution set to fixed

(In [1388]) reviewed by alex. Fixes #763

Note: See TracTickets for help on using tickets.