Condition rule Form::FLOAT

Notice: This thread is very old.
h4kuna
Backer | 740
+
0
-

Hi

I found different behavior if i use rule FLOAT.

Use case:
If I write to input 5,5 that ok change to 5.5. If I uncomment condition I get 5,5 instead of 5.5.

Example:

<?php
public function createComponentForm() {
    $form = new Form;
    $form->addText('float', 'čislo')
            //->addCondition(Form::FILLED)
            ->addRule(Form::FLOAT, 'Je potřeba vyplnit číslo');
    $form->addSubmit('send', 'Uložit');
    $form->onSuccess[] = callback($this, 'processForm');
    return $form;
}

public function processForm($form) {
    $val = $form->getValues();
    dump($val['float']);
}
?>

Nette: 2.0.12
PHP: 5.3.10

Casper
Member | 253
+
0
-

Well this is an old issue reported many times. Here, here and here. Also exists an issue and pull-request on github.

I'm wondering why this isn't fixed for such a long time…