I got a detail page where the form value are selected and users are allowed to edit in the form inputs and even for new case same form is being used.
But i got the problem on validation of username after submitting.
If username already exists in database then error message is displayed which is good for me but in case of update, since the same displayed input needs to be checked and when user tries to save with same username as before it finds the input in database and so again displays error message instead i need it to allow to save. So got no idea?
Thanks in advance for your concern!
You need to have some way of telling whether it is a current user updating his details, or a new user registering. The usual way to do this is to have a login system and record that the user is logged in (e.g. using Session) - in this case you would catch this in your ASP code and run the UPDATE code; otherwise you would run the INSERT code.
Thanx 4 the reply but i have used hidden fields and variable is set empty for new and for update it assigns value according to database. so no session used here. my problem is in validating username on server side. It should satisfy for both new case and update case.
In case of update user should be able to save his current username but cant save other username if exist in database. for new case username can save any name except it is in database.
so that was the problem
ya update and insert all process are carried out. its complete. But i m still stuck on validation of username after submitting the form only in the case of update username ( not in new username). he/she should be able to save his own existing username + new username (that doesnot exist in database). since his existing username is also in database select query selects this username also so i get message USername repeated in case of saving same username again. ( new user also uses same form and in case up editing/updating it uses same form ). thank u.
Thanx guys, Just solved the problem. just missed a if else statement hehe... Actually i hav used ajax but i also want to validate after submitting also. Thank u siteguru and thank u sandeepji. nice 2 hear 4m u guys... very supporting. like +1