modifs.mineures sans commentaires
This commit is contained in:
parent
cb3e55dcc8
commit
81a7f91e65
|
@ -643,7 +643,9 @@ class Form extends ComponentPrintable implements IParametrable, ArrayAccess, Cou
|
||||||
$currentValue = $type->format($currentValue);
|
$currentValue = $type->format($currentValue);
|
||||||
}
|
}
|
||||||
$param["value"] = $value;
|
$param["value"] = $value;
|
||||||
$param["checked"] = $currentValue === $value;
|
#XXX en attendant le formattage ci-dessus, forcer la format texte pour que
|
||||||
|
# la comparaison puisse se faire
|
||||||
|
$param["checked"] = strval($currentValue) === strval($value);
|
||||||
break;
|
break;
|
||||||
case self::NV:
|
case self::NV:
|
||||||
if ($value === null) $value = $this->get($key, $default);
|
if ($value === null) $value = $this->get($key, $default);
|
||||||
|
|
|
@ -7,11 +7,12 @@ use nur\v\js;
|
||||||
/**
|
/**
|
||||||
* Class autosubmitSelectPlugin: soumet le formulaire sur l'événement change
|
* Class autosubmitSelectPlugin: soumet le formulaire sur l'événement change
|
||||||
*/
|
*/
|
||||||
class autosubmitOnChangePlugin extends BasePlugin {
|
class autosubmitOnEventPlugin extends BasePlugin {
|
||||||
const HAVE_JQUERY = true;
|
const HAVE_JQUERY = true;
|
||||||
|
|
||||||
function __construct(string $selector, bool $cond=true) {
|
function __construct(string $selector, string $event="change", bool $cond=true) {
|
||||||
$this->selector = $selector;
|
$this->selector = $selector;
|
||||||
|
$this->event = $event;
|
||||||
$this->cond = $cond;
|
$this->cond = $cond;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,13 +21,16 @@ class autosubmitOnChangePlugin extends BasePlugin {
|
||||||
*/
|
*/
|
||||||
private $selector;
|
private $selector;
|
||||||
|
|
||||||
|
/** @var string événement sur lequel déclencher la soumission du formulaire */
|
||||||
|
private $event;
|
||||||
|
|
||||||
/** @var bool ce plugin est-il activé? */
|
/** @var bool ce plugin est-il activé? */
|
||||||
private $cond;
|
private $cond;
|
||||||
|
|
||||||
function printJquery(): void {
|
function printJquery(): void {
|
||||||
if (!$this->cond) return;
|
if (!$this->cond) return;
|
||||||
?>
|
?>
|
||||||
$(<?=js::qv($this->selector)?>).change(function() {
|
$(<?=js::qv($this->selector)?>).on(<?=js::qv($this->event)?>, function() {
|
||||||
$(this).closest("form").submit();
|
$(this).closest("form").submit();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
Loading…
Reference in New Issue