Buttons? Buttons? Buttons?

Results 1 to 4 of 4

Thread: Buttons? Buttons? Buttons?

  1. #1
    Papa Zito Guest

    Default Buttons? Buttons? Buttons?

    This sounds like a dumber and dumber question every time I look at it, but how do I make ASP respond to a button being pressed? I&#039m creating an input form that inserts a record into a database, and I think that coding is right, but I can&#039t get the silly thing to fire when the Submit button is clicked!

  2. #2
    Join Date
    Dec 1969

    Default RE: Buttons? Buttons? Buttons?

    Submit buttoms IMHO are a waste of time. I&#039d much rather validate the data clientside rather than pass the data to a new page, get the server to run the checks and if everything isn&#039t hunky dory go back to the last page. Yuck.<BR><BR>Try this:<BR><BR>Within your &#060;BODY&#062; tags, type:<BR><BR>&#060;INPUT id=MyBtn type=button value="Click here" onclick="return MyBtn_onclick()"&#062;<BR><BR>then somewhere above it all (wherever you keep your JS code functions):<BR><BR>function MyBtn_onclick()<BR><BR>//do your checks like:<BR><BR>if(txtName=""){<BR>alert("Fill in the name textbox or I send in da boys.");<BR>return;<BR>}<BR><BR>//when you&#039re happy:<BR><BR>window.location.href=NextPage.asp?Na me=" + txtName.value + "&Address=" + txtAddress.value<BR>}<BR><BR>Go for it...<BR>

  3. #3
    Papa Zito Guest

    Default RE: Buttons? Buttons? Buttons?

    My validation is client-side, and it works. The database insertion script is on the same page as the form itself. I want it to run when the button is pressed, after the validation has done its thing.

  4. #4
    Vidya Guest

    Default RE: Buttons? Buttons? Buttons?

    i presume the following is what Ur page looks like..<BR>**************************************** *************************<BR>&#060;some script for validation with a form.submit() in it&#062;<BR><BR>&#060;form&#062;<BR>all fields<BR>&#060;input type = button, name = "abc" value = "abc" onClick = "doscript()"&#062;<BR>&#060;/form&#062;<BR>************************************ *****************************<BR>If this is the case then add the line,<BR><BR>if request.form("abc") = "abc" then <BR>insert whatever<BR>else<BR>&#060;form&#062;<BR>all fields<BR>&#060;input type = button, name = "abc" onClick = "doscript()"&#062;<BR>&#060;input type = "hidden" name = "abc" value "abc"&#062; (after the button declaration.)<BR>&#060;/form&#062;<BR>end if<BR><BR>If this is not it.. well, U will definitely get back..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts