View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
05401 | Bug reports | Survey taking | public | 2011-08-17 14:18 | 2012-03-14 21:08 |
Reporter | Assigned To | tpartner | |||
Priority | low | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 1.91+ | ||||
Summary | 05401: large and huge free text max characters not respected on mouse-based paste events | ||||
Description | Performing a mouse-based paste event, such as a "right mouse-click -> paste" (mouse contextual menu) or selecting the Edit->Paste menu item with the mouse doesn't properly truncate the free text to the set maximum characters attribute set for the question. Key-based paste events, such as CTRL-V is respected and text is truncated. This appears to be the case in the most recent stable builds of Chrome and Firefox on Mac and Windows. The short free text maximum characters attribute does appear to correctly respect both mouse and keyboard based events. | ||||
Steps To Reproduce |
| ||||
Tags | No tags attached. | ||||
Attached Files | 05401-00-maxlength-textarea-limit.diff (1,628 bytes)
### Eclipse Workspace Patch 1.0 #P Limesurvey 1.x trunk stable Index: qanda.php =================================================================== --- qanda.php (revision 10756) +++ qanda.php (working copy) @@ -4966,7 +4966,7 @@ // --> START NEW FEATURE - SAVE $answer .= '<textarea class="textarea '.$kpclass.'" name="'.$ia[1].'" id="answer'.$ia[1].'" alt="'.$clang->gT('Answer').'" ' - .'rows="'.$drows.'" cols="'.$tiwidth.'" onkeyup="textLimit(\'answer'.$ia[1].'\', '.$maxsize.'); '.$checkconditionFunction.'(this.value, this.name, this.type)">'; + .'rows="'.$drows.'" cols="'.$tiwidth.'" maxlength="'.$maxsize.'" onchange="textLimit(\'answer'.$ia[1].'\', '.$maxsize.');" onkeyup="textLimit(\'answer'.$ia[1].'\', '.$maxsize.'); '.$checkconditionFunction.'(this.value, this.name, this.type)">'; // --> END NEW FEATURE - SAVE if ($_SESSION[$ia[1]]) {$answer .= str_replace("\\", "", $_SESSION[$ia[1]]);} @@ -5056,7 +5056,7 @@ // --> START NEW FEATURE - SAVE $answer .= '<textarea class="textarea '.$kpclass.'" name="'.$ia[1].'" id="answer'.$ia[1].'" alt="'.$clang->gT('Answer').'" ' - .'rows="'.$drows.'" cols="'.$tiwidth.'" onkeyup="textLimit(\'answer'.$ia[1].'\', '.$maxsize.'); '.$checkconditionFunction.'(this.value, this.name, this.type)">'; + .'rows="'.$drows.'" cols="'.$tiwidth.'" maxlength="'.$maxsize.'" onchange="textLimit(\'answer'.$ia[1].'\', '.$maxsize.');" onkeyup="textLimit(\'answer'.$ia[1].'\', '.$maxsize.'); '.$checkconditionFunction.'(this.value, this.name, this.type)">'; // --> END NEW FEATURE - SAVE // <-- END ENHANCEMENT - TEXT INPUT WIDTH | ||||
Bug heat | 10 | ||||
Complete LimeSurvey version number (& build) | 10746 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | mysql 5.0.77 | ||||
Server OS (if known) | CentoOS 5.4 | ||||
Webserver software & version (if known) | apache 2.2 | ||||
PHP Version | 5.1 | ||||
An additional "maxlength" attribute for the "textarea" tag could make the browser limit the input w/o javascript need (Number of Unicode Codepoints, HTML5). Additionally to make the javascript routine work, the "onchange" and/or "onblur" event needs to be added that at least the text is getting truncated when the focus is lost. |
|
Tony, refering to mot's comment, do you think we can easily solve this special pasting method? |
|
I think IE9 still doesn't support the "maxlength" attribute for the "textarea" tag. |
|
IE may not support maxlength for textareas but it is a valid attribute in HTML5 so I added it. Also added the onchange event and moved function textLimit() to survey_runtime.js. Thanks everyone for the input. Fixed in revision 10949. |
|
New version released |
|
LimeSurvey: Yii 55824b28 2011-09-05 09:21:46 Details Diff |
Fixed issue 05401: large and huge free text max characters not respected on mouse-based paste events Dev Added onchange event to textareas to fire textLimit() Dev Moved function textLimit() to survey_runtime.js git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_ci@10948 b72ed6b6-b9f8-46b5-92b4-906544132732 |
Affected Issues 05401 |
|
mod - application/helpers/qanda_helper.php | Diff File | ||
mod - scripts/survey_runtime.js | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-08-17 14:18 |
|
New Issue | |
2011-08-17 19:18 | mot | Note Added: 16087 | |
2011-08-17 19:21 | mot | File Added: 05401-00-maxlength-textarea-limit.diff | |
2011-08-18 16:10 | Mazi | Assigned To | => tpartner |
2011-08-18 16:10 | Mazi | Status | new => assigned |
2011-08-18 16:11 | Mazi | Note Added: 16098 | |
2011-08-18 16:23 |
|
Note Added: 16099 | |
2011-09-05 18:28 | tpartner | Note Added: 16230 | |
2011-09-05 18:28 | tpartner | Status | assigned => resolved |
2011-09-05 18:28 | tpartner | Resolution | open => fixed |
2011-09-07 09:16 | c_schmitz | Note Added: 16237 | |
2011-09-07 09:16 | c_schmitz | Status | resolved => closed |
2012-03-14 21:08 | tpartner | Changeset attached | => Import 2012-03-09 13:30:34 Yii 55824b28 |