Click to See Complete Forum and Search --> : Corrupting Variable Value


lfirth
05-09-2005, 11:09 PM
The field 'fldAverVal' is a currency value and in the table has a value of '50000', the value is first read from a database and assigned a variable:
intAverVal = objRec.Fields("fldAverVal")

The value is not displayed on the next form but will be needed on the one after that so I need to remember it so in my form I assign it to a hidden text field, at this point I know the value is still correct:
<input name="AverVal" type="hidden" value="<%= intAverVal %>">

When I submit to the next form the value has been corrupted in some way and had a '0, ' added to the start of the string. i.e. '0, 50000'
intAverVal = Request.Form("AverVal")

I have no idea where this is coming from.

buntine
05-10-2005, 12:25 AM
Heve you looked at the source code of the first form and seen:

<input name="AverVal" type="hidden" value="50000">

?

Seems to me that the data is being changed before being printed to the HTML form.

Regards.

lfirth
05-10-2005, 12:35 AM
Yes the source code displays correctly:
<input name="AverVal" type="hidden" value="50000">

But when I try to submit the next form I get the following error:
Error Type:
Provider (0x80020005)
Type mismatch.
/bea/ConvertBuilder.asp, line 579

This is because it is trying to write "0, 50000" to a currency field.

It's really weird cos I have 3 very similar fields and it only happens on the one.

lfirth
05-10-2005, 12:56 AM
Found It!

I had two form fields named the same one had a default value of "0", so when I tried to submit the form both values were being accepted "0" and "50000".

You wouldn't believe how long I've spent trying to work out this problem.

Thanks for the help.

buntine
05-10-2005, 01:04 AM
Ahh! Yes, I should have picked up on that. Good job. ;)