This topic is locked

Number field

1/30/2008 2:10:49 PM
PHPRunner General questions
H
horsey_kim author

I have a weight field that in the database is set up as "int".

In the visual editor I have set the field to "view as" number and "edit as" text with validation as a number.
But if the user puts in 51,000 with a comma it enters 51. If they put in the value 51000 then they get 51000
My question is, how would I using the visual editor make it where an error message would pop up saying "invalid number value". OR have it automatically strip out , from the number.
Kim <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=7408&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

J
Jane 1/31/2008

Kim,
you can check and convert entered value in the Before record added event on the Events tab.

Here is a sample:

$values["FieldName"] = intval(str_replace(",","",$values["FieldName"]));

H
horsey_kim author 1/31/2008

Thank you - perfect! Your awesome!
Kim