Firefox PHP

Verfication of a field

Posted by GabrielShier 
Verfication of a field
July 26, 2008 04:52AM
Hey,

needs help verifing that a field is numeric only. the field name is f_phone and it can recieve any kind of input. how do i check if it's just a numeric value and if not than dies?
Re: Verfication of a field
July 26, 2008 06:46AM
I deleted your other post about this subject, because it was a duplicate issue.

This is a custom profile field that you added? You would have to write a module that checks the data that the users enters. There is no ready-to-go solution available. It would have to implement the "before_register" hook and set the "error" field in its return data if the field is not a number. That would make it possible to validate the value at registration time. For validating the data if you have a change option in the control center, you would need to implement the "cc_save_user" hook.

Another option would be to look for some client side javascript code that validates the user input. It's not air-tight, because users without javascript would still be able to fill in non-numbers, but it's a reasonably good solution (the number of users without javascript is very very low nowadays).


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login