Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem With Form Sending Back a StringList Instead of an Int

Status
Not open for further replies.

pparadis

MIS
Dec 5, 2000
22
0
0
US
I have a form that edits budget information. When I create the form I pull the existing budget numbers and put the values in text boxes by using the value attribute. The user is suppossed to be able to type over the existing number and update the database to a new number. The problem I'm having is when I send the form to the server to write the data to the table, it gives me a StringList. For example if the budget existing data is 500 and its changed to 400 and then submited, the value it sends is:
4, 5 and then I'm given a data type mismatch.

Any suggestions?
 
can you post how your <input> tag is formatted? i don't understand how you get 4, 5. If 500 is overwritten with 400, then it should submit 400 in the form.....
 
I'm a bit lost as to your 4, 5 message as well, however I belive it is a data type mismatch because it's probably trying to enter it as a number when it should be a string. On your next page...your processing page, try forcing the variable as a CStr() like so...

---Form Page-------

<form method='post' action='processingPage.asp'>
<input type='text' name='theNumber' value='<%= rs(&quot;myInputNumber&quot;) %>'>Input Number<BR>
<input type='submit' value='Submit'>
</form>




---ProcessingPage.asp----------

<%
Dim numb
numb = CStr(Request.Form(&quot;theNumber&quot;))

sql = &quot;UPDATE myTable SET myTable.theNumber='&quot; & numb & &quot;' WHERE ((myTable.thePK)=1);&quot;
conn.Execute(sql)
%>



Hope this helps...if not, please be a little more clear.

-Ovatvvon :-Q
 
The input tag is created dynamically depending on the number of years and types of funding for a project so it uses variables to generate some of the text box names. They would look something like this:

<input type=&quot;text&quot; size=&quot;5&quot; value=&quot;<%Response.Write&quot;&quot;&objRS(&quot;Amt&quot;)&&quot;&quot;%>&quot; name=&quot;OM2001&quot;/>

I then submit that form using &quot;POST&quot;

I used the vbTerm to see what the data type was that I was getting in the script where I execute the update query and it said it was IStringList which I'm guessing is an Integer String List.

So if a budget value starts off as 500 and I change it to 400 it gives me 5, 4 in the update script causing a data mismatch because what I need is the integer and I'm getting a string.

NOTE: If I use &quot;GET&quot; and send the info through the Address Line it's fine, I only have a problem when using the Request.Form object.

Hope this gives you the info you were looking for.

Thanks.
 
Well, first off, change:

<input type=&quot;text&quot; size=&quot;5&quot; value=&quot;<%Response.Write&quot;&quot;&objRS(&quot;Amt&quot;)&&quot;&quot;%>&quot; name=&quot;OM2001&quot;/>


to

<input type=&quot;text&quot; size=&quot;5&quot; value=&quot;<%= objRS(&quot;Amt&quot;)%>&quot; name=&quot;OM2001&quot;/>

That will enter the actual value as is, rather than writing as a string into the value which will take more time anyway.

See if that helps at all, not sure that it will though.

Only thing I can say is...if you know you NEED it to be an Integer, then force it to be an integer using newValue = CInt(Request.Form(&quot;budgetValue&quot;))


Hope this helps!

-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top