Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: validateInteger #165

Closed
djdaca opened this issue Aug 7, 2017 · 7 comments

Comments

@djdaca
Copy link

commented Aug 7, 2017

  • bug report? yes
  • feature request? no

Description

Snad omluvíte češtinu :)
Problém vidím v parsování hodnoty do INT:
$value = "0123456";
if (Validators::isNumericInt($value = $control->getValue())) {
// $value = "0123456";
if (!is_float($tmp = $value * 1)) { // bigint leave as string
// $tmp = 123456
$control->setValue($tmp);
}
}

Steps To Reproduce

$value = 123456, $result = INT(123456) // OK
$value = 0123456, $result = INT(123456) // ERROR

Chtělo by to ještě nějak pokrýt numeric hodnoty, nejen float :)

@dg

This comment has been minimized.

Copy link
Member

commented Aug 7, 2017

We don't, in the times of the Google Translator.

What is wrong?

@djdaca

This comment has been minimized.

Copy link
Author

commented Aug 8, 2017

Ok here is example:

I want validate VAT number - its numeric value, so i validate like numeric and in the next step i validate if TIN number exist.

I have TIN: 04011236
Validators::isNumericInt(04011236) return true becose its VALID numeric value.

But on next row u transfer my TIN number to int: (04011236*1) = 4011236
And if i check from SOAP if TIN exist in europe 4011236 not exist becose you transfer tin number to int.

I validate form like:
->addRule(Form::NUMERIC, "DIČ zadejte prosím jako číslo bez kódu státu")
->addRule(SubjectFormRules::RULE_TIN, 'Máte špatně vyplněné DIČ', $Form[Subject::COLUMN_ADDR_COUNTRY]);

I validate VAT like numeric - so why you convert my numeric number to int ?
PS: pořád myslíš že angličtina je lepší ? :))

@dg

This comment has been minimized.

Copy link
Member

commented Aug 9, 2017

I understand you perfectly :)

@dg dg closed this in 65793fa Aug 9, 2017

@dg

This comment has been minimized.

Copy link
Member

commented Aug 9, 2017

Because of compatibility it can not be fixed in 2.4, so use addRule(Form::PATTERN, "DIČ zadejte prosím jako číslo bez kódu státu", '\d+')

@djdaca

This comment has been minimized.

Copy link
Author

commented Aug 9, 2017

Ok, thanx 👍

@thebellenik

This comment has been minimized.

Copy link

commented Aug 24, 2017

Taky jsem měl s tímto problém, nestalo by za to přidat to do dokumentace?

@dg

This comment has been minimized.

Copy link
Member

commented Aug 24, 2017

To by bylo fajn, mohl bys prosím poslat PR do https://github.com/nette/docs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.