Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

How to validate bigint (10 digits or more like mobile no)? #11

Open
spurgeonbj opened this issue Jul 16, 2016 · 8 comments
Open

How to validate bigint (10 digits or more like mobile no)? #11

spurgeonbj opened this issue Jul 16, 2016 · 8 comments

Comments

@spurgeonbj
Copy link

Hi!

Greetings!

While validating mobile number (for 10 digits) as integer, it accepts only typical integer value (65535).

Is bigint supported? other than through regex of course.

Was also looking for date, but couldnt find.

Thank you!
warm regards and gratitude for the nice framework that saves tons of work.
Spurgeon

@alexweissman
Copy link
Member

Oh - interesting! Is it failing in client-side validation, or server-side?

@spurgeonbj
Copy link
Author

Hi Alex,

Not sure, BTW, how to check?

Validation occurs on form submit, so presume it is server side.

For now, i've used "numeric" in which '9.9' happens to be a valid mobile no!

FYI pl.
Thanks!

@alexweissman
Copy link
Member

so it lets you submit the form (showing all fields as green), but then it gives an error? This would be server side, then.

BTW: with issues, you don't need salutations and signatures. Just your comment is enough.

@spurgeonbj
Copy link
Author

Thanks! Server side.

@alexweissman
Copy link
Member

Ok, so that would be in Valitron, which internally uses FILTER_VALIDATE_INT.

This might be platform dependent, see http://stackoverflow.com/questions/31070807/filter-var-and-validating-integer-values. One thing that could be done is to explicitly set the minimum and maximum range for integers in the call to filter_var. See http://php.net/manual/en/filter.filters.validate.php.

@spurgeonbj
Copy link
Author

Thanks for saving my day!

On Sun, Jul 17, 2016 at 1:48 AM, Alex Weissman [email protected]
wrote:

Ok, so that would be in Valitron, which internally uses
FILTER_VALIDATE_INT
https://github.com/vlucas/valitron/blob/master/src/Valitron/Validator.php#L223-L226
.

This might be platform dependent, see
http://stackoverflow.com/questions/31070807/filter-var-and-validating-integer-values.
One thing that could be done is to explicitly set the minimum and maximum
range for integers in the call to filter_var. See
http://php.net/manual/en/filter.filters.validate.php.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGbU2XA6qnW88aoJyfx8J0dKDfPUOvWlks5qWTyrgaJpZM4JN-Tk
.

@alexweissman
Copy link
Member

No problem - were you able to fix it? I wonder if Valitron would consider adding explicit values for min_range and max_range.

@spurgeonbj
Copy link
Author

Not yet.. using 'numeric' for now. will work on this and keep you posted.. :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants