mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-08 00:56:52 +01:00
(fixes issue 1968) Fixed inconsistence in CActiveForm error highlighting when checkBoxList or radioButtonList are used
This commit is contained in:
@@ -6,6 +6,7 @@ Version 1.1.9 work in progress
|
||||
------------------------------
|
||||
- Bug: Removed unnecessary COciCommandBuilder::createInsertCommand quotes (Sam Dark)
|
||||
- Bug: CHttpRequest.sendFile() gives incorrect content length when output_handler is enabled through code or non output_handler directive (Sam Dark)
|
||||
- Bug #1968: Fixed inconsistence in CActiveForm error highlighting when checkBoxList or radioButtonList are used (mdomba)
|
||||
- Bug #2603: Fixed the bug that CDbHttpSession::regenerateID call when session isn't started results in SQL error (Sam Dark)
|
||||
- Bug #2623: Fixed the bug that by setting multiple classes in CGridView itemsCssClass prevents rows being selected (mdomba)
|
||||
- Bug #2635: MigrateCommand migration execution time is now measured correctly (Sam Dark)
|
||||
|
||||
14
UPGRADE
14
UPGRADE
@@ -27,6 +27,20 @@ Upgrading from v1.1.8
|
||||
- In CErrorHandler::handleException() the checking for ajax call has been removed
|
||||
as it was preventing to customize the display of the exception during an ajax call.
|
||||
|
||||
- Previously in case of validation error the CSS "error" class was not added to the row container at all when
|
||||
checkBoxList or radioButtonList where used. This is fixed now and proper "error" CSS class is added to the row
|
||||
container but in case of validation error, all labels from the list are shown in red because of the CSS rule.
|
||||
|
||||
To fix this and display only the attribute label in red:
|
||||
|
||||
in <projectdir>/css/form.css the line:
|
||||
|
||||
div.form div.error label
|
||||
|
||||
should be changed to
|
||||
|
||||
div.form div.error label:first-child
|
||||
|
||||
- If you've used "through" ActiveRecord option in your relation definitions it's good to update code as shown below.
|
||||
Old style of defining this option still works but is now deprecated.
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ div.form span.required
|
||||
color: red;
|
||||
}
|
||||
|
||||
div.form div.error label,
|
||||
div.form div.error label:first-child,
|
||||
div.form label.error,
|
||||
div.form span.error
|
||||
{
|
||||
|
||||
@@ -918,7 +918,7 @@ EOD;
|
||||
$cs->registerScript($id,$js);
|
||||
}
|
||||
|
||||
return implode($separator,$items);
|
||||
return self::tag('span',array('id'=>$baseID),implode($separator,$items));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -963,7 +963,7 @@ EOD;
|
||||
$label=self::label($label,$htmlOptions['id'],$labelOptions);
|
||||
$items[]=strtr($template,array('{input}'=>$option,'{label}'=>$label));
|
||||
}
|
||||
return implode($separator,$items);
|
||||
return self::tag('span',array('id'=>$baseID),implode($separator,$items));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
*/
|
||||
$.fn.yiiactiveform = function(options) {
|
||||
return this.each(function() {
|
||||
var settings = $.extend({}, $.fn.yiiactiveform.defaults, options || {});
|
||||
var $form = $(this);
|
||||
var id = $form.attr('id');
|
||||
var settings = $.extend({}, $.fn.yiiactiveform.defaults, options || {}),
|
||||
$form = $(this);
|
||||
|
||||
if(settings.validationUrl == undefined)
|
||||
settings.validationUrl = $form.attr('action');
|
||||
$.each(settings.attributes, function(i,attribute){
|
||||
@@ -82,8 +82,8 @@
|
||||
|
||||
$.each(settings.attributes, function(i, attribute) {
|
||||
if (attribute.validateOnChange) {
|
||||
$('#'+attribute.inputID, $form).change(function(){
|
||||
validate(attribute, this.type=='checkbox' || this.type=='radio');
|
||||
$('#'+attribute.inputID, $form).change(function(e){
|
||||
validate(attribute, e.target.type=='checkbox' || e.target.type=='radio');
|
||||
}).blur(function(){
|
||||
if(attribute.status!=2 && attribute.status!=3)
|
||||
validate(attribute, !attribute.status);
|
||||
@@ -152,8 +152,8 @@
|
||||
setTimeout(function(){
|
||||
$.each(settings.attributes, function(i, attribute){
|
||||
attribute.status = 0;
|
||||
var $error = $('#'+attribute.errorID, $form);
|
||||
var $container = $.fn.yiiactiveform.getInputContainer(attribute, $form);
|
||||
var $error = $('#'+attribute.errorID, $form),
|
||||
$container = $.fn.yiiactiveform.getInputContainer(attribute, $form);
|
||||
|
||||
$container.removeClass(
|
||||
attribute.validatingCssClass + ' ' +
|
||||
@@ -213,9 +213,10 @@
|
||||
*/
|
||||
$.fn.yiiactiveform.updateInput = function(attribute, messages, form) {
|
||||
attribute.status = 1;
|
||||
var hasError = messages!=null && $.isArray(messages[attribute.id]) && messages[attribute.id].length>0;
|
||||
var $error = $('#'+attribute.errorID, form);
|
||||
var $container = $.fn.yiiactiveform.getInputContainer(attribute, form);
|
||||
var hasError = messages!=null && $.isArray(messages[attribute.id]) && messages[attribute.id].length>0,
|
||||
$error = $('#'+attribute.errorID, form),
|
||||
$container = $.fn.yiiactiveform.getInputContainer(attribute, form);
|
||||
|
||||
$container.removeClass(
|
||||
attribute.validatingCssClass + ' ' +
|
||||
attribute.errorCssClass + ' ' +
|
||||
@@ -243,10 +244,10 @@
|
||||
* @param messages array the json data obtained from the ajax validation request
|
||||
*/
|
||||
$.fn.yiiactiveform.updateSummary = function(form, messages) {
|
||||
var settings = $(form).data('settings');
|
||||
var settings = $(form).data('settings'),
|
||||
content = '';
|
||||
if (settings.summaryID == undefined)
|
||||
return;
|
||||
var content = '';
|
||||
$.each(settings.attributes, function(i, attribute){
|
||||
if(messages && $.isArray(messages[attribute.id])) {
|
||||
$.each(messages[attribute.id],function(j,message){
|
||||
@@ -266,11 +267,10 @@
|
||||
* @param errorCallback function the function to be invoked if the ajax request fails
|
||||
*/
|
||||
$.fn.yiiactiveform.validate = function(form, successCallback, errorCallback) {
|
||||
var $form = $(form);
|
||||
var settings = $form.data('settings');
|
||||
|
||||
var messages = {};
|
||||
var needAjaxValidation = false;
|
||||
var $form = $(form),
|
||||
settings = $form.data('settings'),
|
||||
needAjaxValidation = false,
|
||||
messages = {};
|
||||
$.each(settings.attributes, function(){
|
||||
var msg = [];
|
||||
if (this.clientValidation != undefined && (settings.submitting || this.status == 2 || this.status == 3)) {
|
||||
@@ -297,8 +297,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var $button = $form.data('submitObject');
|
||||
var extData = '&'+settings.ajaxVar+'='+$form.attr('id');
|
||||
var $button = $form.data('submitObject'),
|
||||
extData = '&'+settings.ajaxVar+'='+$form.attr('id');
|
||||
if($button && $button.length)
|
||||
extData += '&'+$button.attr('name')+'='+$button.attr('value');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user