[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-cgicc] Limits in getDoubleValue and getIntegerValue
From: |
Quintin Connell |
Subject: |
Re: [help-cgicc] Limits in getDoubleValue and getIntegerValue |
Date: |
Thu, 07 Nov 2002 17:59:04 +0200 (SAST) |
User-agent: |
IMP/PHP IMAP webmail program 2.2.6 |
Something like this may work
long value1 = atol(element->getValue.c_str());
long value2 = element->getIntegerValue(min, max);
if (value1 == value2) {
// no difference
}
else {
// value2 clamped hence originally exceeded limit
}
Alternatively you maybe could look at JavaScript to validate the
user input before it gets to the cgi script.
Quintin
Quoting "Carsten P. Gehrke" <address@hidden>:
> As I understand from the documentation and the source code, the
> FormEntry::getDoubleValue method silently clamps the returned value to
> the
> min and max parameters, if these are given. Is there any way to check
> if
> the value of the CGI parameter was outside the limits? E.g. if I have a
>
> CGI argument list containing d=85.9, and I use getDoubleValue(-75.0,
> 75.0),
> the value I get for d will be 75.0, while a CGI with d=75.0 would also
> give
> me a value of 75.0. It would be useful to know that in the first case
> the
> value of d was outside the limits, while in the second case it was OK.
>
> I think the same applies to the getIntegerValue method.
>
> Thank you,
> Carsten
>
>
> --
> ========================================================================
> Carsten P. Gehrke
> mailto:address@hidden
> ========================================================================
>
>
>
>
>
> _______________________________________________
> help-cgicc mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-cgicc
>
>