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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript Validation connected with database.

Status
Not open for further replies.

svsuthar1

Programmer
Jul 6, 2004
135
US
Hi,

Is it any way you could connect to database with javascript to validate your form data with database table.

For Ex.

I have text field on a form and wanted to make sure what is entered there is in the database table so when it's trying to save that into a table it does not give a error message.

I hope i am making sense here... if this is not possible (connection to database).. then what are some alternative thing i could do to achive that same thing.

Samir
 
When you want to connect to a database, you need server-side coding like ASP, PHP, or ColdFusion. You could then check user input against the database.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
zen.gif

 
In the next version of ASP.NET you'll be able to do this using "code-beside" pages which will make asynchronous calls (I'm guessing using the XMLHttp object). You can do this now using the same technique. These guys show you how and use it in at least one app on their site.

A different quick and dirty way to do it is to submit a form in a hidden frame and have the return page write out JavaScript to update your main page.

Adam
 
Thanks guys,

Hi mwolf00, adam0101,

I know about database connection at client side, but that is too late for me to verify what the user has entered is correct. I don't want to use a combo box because i have to many records and combo box would be to time consuming for use to go through and pick one. So my plan was to just have text box and after the user has entered the info and tab to next field if the info is wrong then it would pop with msgbox saying what u have entered is not usable please fix the error. or somthing like that.


Is there any code or something I could do to do this besides learning asp.net which would take little long for me to do right now.

I have used java, vb script's to do null fields or numeric etc.. but never verifying user info to valid data in database or something.

Any ideas is appreciated.


Thanks,

Samir

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top