mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
fixed radiobutton not (always) returning correct value plus fixing ide warnings
This commit is contained in:
parent
e84d243b5d
commit
8d86f8496b
@ -103,6 +103,8 @@ var et2_radiobox = et2_inputWidget.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Override default to match against set/unset value AND iterate over all siblings with same id
|
* Override default to match against set/unset value AND iterate over all siblings with same id
|
||||||
|
*
|
||||||
|
* @param {string} _value
|
||||||
*/
|
*/
|
||||||
set_value: function(_value)
|
set_value: function(_value)
|
||||||
{
|
{
|
||||||
@ -116,13 +118,22 @@ var et2_radiobox = et2_inputWidget.extend(
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override default to return unchecked value
|
* Override default to iterate over all siblings with same id
|
||||||
|
*
|
||||||
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
getValue: function() {
|
getValue: function()
|
||||||
if(jQuery("input:checked", this._parent.getDOMNode()).val() == this.options.set_value) {
|
{
|
||||||
return this.options.set_value;
|
var val = this.options.value; // initial value, when form is loaded
|
||||||
|
this.getRoot().iterateOver(function(radio)
|
||||||
|
{
|
||||||
|
if (radio.id == this.id && radio.input && radio.input.prop('checked'))
|
||||||
|
{
|
||||||
|
val = radio.options.set_value;
|
||||||
}
|
}
|
||||||
return null;
|
}, this, et2_radiobox);
|
||||||
|
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
et2_register_widget(et2_radiobox, ["radio"]);
|
et2_register_widget(et2_radiobox, ["radio"]);
|
||||||
@ -175,6 +186,8 @@ var et2_radiobox_ro = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Override default to match against set/unset value
|
* Override default to match against set/unset value
|
||||||
|
*
|
||||||
|
* @param {string} _value
|
||||||
*/
|
*/
|
||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
if(_value == this.options.set_value) {
|
if(_value == this.options.set_value) {
|
||||||
@ -186,6 +199,8 @@ var et2_radiobox_ro = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Code for implementing et2_IDetachedDOM
|
* Code for implementing et2_IDetachedDOM
|
||||||
|
*
|
||||||
|
* @param {array} _attrs
|
||||||
*/
|
*/
|
||||||
getDetachedAttributes: function(_attrs)
|
getDetachedAttributes: function(_attrs)
|
||||||
{
|
{
|
||||||
@ -296,7 +311,8 @@ var et2_radioGroup = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a bunch of radio buttons
|
* Set a bunch of radio buttons
|
||||||
* Options should be {value: label, ...}
|
*
|
||||||
|
* @param {object} _options object with value: label pairs
|
||||||
*/
|
*/
|
||||||
set_options: function(_options) {
|
set_options: function(_options) {
|
||||||
for(var key in _options)
|
for(var key in _options)
|
||||||
@ -322,6 +338,8 @@ var et2_radioGroup = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a label on the group of radio buttons
|
* Set a label on the group of radio buttons
|
||||||
|
*
|
||||||
|
* @param {string} _value
|
||||||
*/
|
*/
|
||||||
set_label: function(_value) {
|
set_label: function(_value) {
|
||||||
// Abort if ther was no change in the label
|
// Abort if ther was no change in the label
|
||||||
@ -335,7 +353,7 @@ var et2_radioGroup = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
// Create the label container if it didn't exist yet
|
// Create the label container if it didn't exist yet
|
||||||
if (this._labelContainer == null)
|
if (this._labelContainer == null)
|
||||||
{
|
{
|
||||||
this._labelContainer = $j(document.createElement("label"))
|
this._labelContainer = $j(document.createElement("label"));
|
||||||
this.getSurroundings().insertDOMNode(this._labelContainer[0]);
|
this.getSurroundings().insertDOMNode(this._labelContainer[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,6 +383,8 @@ var et2_radioGroup = et2_valueWidget.extend([et2_IDetachedDOM],
|
|||||||
* Code for implementing et2_IDetachedDOM
|
* Code for implementing et2_IDetachedDOM
|
||||||
* This doesn't need to be implemented.
|
* This doesn't need to be implemented.
|
||||||
* Individual widgets are detected and handled by the grid, but the interface is needed for this to happen
|
* Individual widgets are detected and handled by the grid, but the interface is needed for this to happen
|
||||||
|
*
|
||||||
|
* @param {object} _attrs
|
||||||
*/
|
*/
|
||||||
getDetachedAttributes: function(_attrs)
|
getDetachedAttributes: function(_attrs)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user