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

custom javascript and requiredfieldvalidator 1

Status
Not open for further replies.

DotNetGnat

Programmer
Mar 10, 2005
5,548
0
0
IN
Guys,

I have (lets say) a form with one field search field...i put a required field validator which will signal when the search textbox is empty...which works fine..no problem there...

now i have added a custom javascript onClick event that shows the progress bar...something like this...

btnsubmit.Atrributes.Add("onClick", showObject(Process);")

now what happens is if the textbox is empty and the submit button is clicked the Process object shows up besides the requiredfieldvalidator...

how can show this object only after requiredfieldvalidator event...

-DNG
 
Just a thought:
change showObject(Process) to showObject(Process, txt)
txt is the asp textbox you are validating.

change: btnsubmit.Atrributes.Add("onClick", showObject(Process);")
to: btnsubmit.Atrributes.Add("onClick", showObject(Process, '" & txtSearch.ID & "');")

Note: replace "txtSearch" with the name of your text box

in the javascript function showObject(Process, txt) add an if statement to check if the text box is empty, if it is don't display your message. i.e.
if (txt.value.length > 0)
{
//Code to display your progress bar.
}



Let me put it this way:
While StressLevel Is High
Productivity -= 1
Marriage = Nothing
End While
 
sounded like a good idea...but didnt work...

Thanks

-DNG
 
oops...i am sorry...had a typo...that worked great...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top