Textbox value validation using database table

Textbox value validation using database table

am 17.03.2006 02:37:12 von Kermit Piper

Hello,

I've done this with drop-downs where I loop through a recordset,
populated another drop-down and so forth. But I think this should be
easier, but I'm not sure. I have a table with states, cities and rates.
What I need to do is when a user selects a certain state from a drop
down, and then enters the city in a text box, the name entered in the
city is validated against the values in the table (WHERE city = XXX).
Then, there is another readonly field that I need populated with the
rates value associated with that city. If someone could show me an
example of what I'm trying to do it would be greatly appreciated.

Thanks in advance,
KP

Re: Textbox value validation using database table

am 17.03.2006 04:58:06 von Roland Hall

"Kermit Piper" wrote in message
news:1142559430.838419.173270@z34g2000cwc.googlegroups.com.. .
: I've done this with drop-downs where I loop through a recordset,
: populated another drop-down and so forth. But I think this should be
: easier, but I'm not sure. I have a table with states, cities and rates.
: What I need to do is when a user selects a certain state from a drop
: down, and then enters the city in a text box, the name entered in the
: city is validated against the values in the table (WHERE city = XXX).
: Then, there is another readonly field that I need populated with the
: rates value associated with that city. If someone could show me an
: example of what I'm trying to do it would be greatly appreciated.

Why not just show the cities and let them select?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Re: Textbox value validation using database table

am 17.03.2006 19:45:57 von nvanhaaster

This is possible, i have done it a few times using an ASP with a
VBscript function. I can't think of any tutorials for this however i
will send you an example


Roland Hall wrote:
> "Kermit Piper" wrote in message
> news:1142559430.838419.173270@z34g2000cwc.googlegroups.com.. .
> : I've done this with drop-downs where I loop through a recordset,
> : populated another drop-down and so forth. But I think this should be
> : easier, but I'm not sure. I have a table with states, cities and rates.
> : What I need to do is when a user selects a certain state from a drop
> : down, and then enters the city in a text box, the name entered in the
> : city is validated against the values in the table (WHERE city = XXX).
> : Then, there is another readonly field that I need populated with the
> : rates value associated with that city. If someone could show me an
> : example of what I'm trying to do it would be greatly appreciated.
>
> Why not just show the cities and let them select?
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp

Re: Textbox value validation using database table

am 17.03.2006 20:08:27 von nvanhaaster

Here is a rough example, as you see as soon as you change the City text
box it will resend the data back to the server and then display the
rate back. You notice i made a call to rsRate() replace this with your
Database string, and also make sure that you set up your DB connection.
I haven't really tested in so there may be some small issues but it
will give you somewhere to start.

WATCH FOR WORD WRAP






<%
Dim cState
Dim cText
Dim rate

cState = Request.QueryString("cState")
cText = Request.QueryString("cText")

response.write "

"
response.write "State : onCHANGE=rateUpdate()>" 'Display city and fill in if user has entered
data

If cState <> "" AND cText <> "" then
rsRate.MoveFirst
Do While Not rsRate.EOF
If rsRate("State") = cState AND rsRate("City") = cText Then
response.write "Rate : "
End If
rsRate.MoveNext
Loop
End If
rsRate.Close
response.write "
"
%>

Re: Textbox value validation using database table

am 20.03.2006 04:40:19 von Kyle Peterson

some of this may help

http://www.powerasp.com/content/code-snippets/forms-populate -drop-down-menu.asp

http://www.powerasp.com/content/code-snippets/forms-populate -check-box.asp\

http://www.powerasp.com/content/code-snippets/forms-populate -radio-buttons.asp


"Kermit Piper" wrote in message
news:1142559430.838419.173270@z34g2000cwc.googlegroups.com.. .
> Hello,
>
> I've done this with drop-downs where I loop through a recordset,
> populated another drop-down and so forth. But I think this should be
> easier, but I'm not sure. I have a table with states, cities and rates.
> What I need to do is when a user selects a certain state from a drop
> down, and then enters the city in a text box, the name entered in the
> city is validated against the values in the table (WHERE city = XXX).
> Then, there is another readonly field that I need populated with the
> rates value associated with that city. If someone could show me an
> example of what I'm trying to do it would be greatly appreciated.
>
> Thanks in advance,
> KP
>

Re: Textbox value validation using database table

am 20.03.2006 08:41:11 von nvanhaaster

Were you able to solve your problem? If not i have a few tutorials i
came across