• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird 1.3.3: Validation of currency on the rate field

 
Ravikiran Vishnuvajhala
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a field that contains the currency symbol and the amount for the room. The following is the instruction statement from SUN -


I am debating about the following points regarding the validation of currency on the "rate" field. Please execuse me if some of them are pretty basic questions -

1. How many bytes should I allocate for the currency symbol? Can I assume one byte?
2. How will I validate the float/double value after the symbol? Also, can the symbol be the last character in the field value?

3. Depending on the currency, it could have a "." or a "," as the decimal symbol.
4. How many digits can be present after the decimal?

Do you think there is a easy way to validate these or I leaning towards not doing the validation at all and just document it that when data class is directly invoked, users need to enter a valid value?

Or can I make some choices here like - one byte for currency and digits after decimals can be only two and the decimal separtor symbol can be only "." and that the currency symbol should be at the beginning of the field?

Or if there is a way to validate all these, please do let me know.

Thanks
Ravi

[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]

[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]

[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]
[ March 25, 2007: Message edited by: Ravikiran Vishnuvajhala ]
 
chris bajada
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you need the currency symbol for? As far as i know there is no calculation to be done with the prices, thus we can treat all prices as strings with no validation whatsoever
 
Ravikiran Vishnuvajhala
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if someone is calling the create,update methods directly on the Data class, they can send garbage like "$abc.123", "$123.abc" or "$123,abc" right. Don't we need to prevent that?
 
Lucy Hummel
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravi,

This week the parsing/checking of the concurrency was already discussed and I think
Li made a good point why and when to check the symbol.

Br, Lucy
 
Ravikiran Vishnuvajhala
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After thinking more about it and from what you people mentioned, I also now think what you people are saying does make sense. This field cannot be manipulated in any way other than users directly accessing the Data Class to enter some useless data. Then, I guess it is their problem.

Thanks a lot for your suggestions and inputs.

Thanks
Ravi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic