Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 7th, 2005, 10:35 AM
XXL XXL is offline
Authorized User
 
Join Date: Dec 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx for the code Matt!
It works fine now!
THX AGAIN!

 
Old January 8th, 2005, 01:40 PM
Authorized User
 
Join Date: Dec 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi guys
"<input type="image" value="search" src="img/go.gif" width="48" height="25" border="0" onclick="submitForm();" style="cursor:hand" name="search" align="absbottom">" ---> this code is image submit button, isnt it?
on above is written "onclick="submitform()",may i know the function code.. thx
cheers

 
Old January 8th, 2005, 07:38 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;this code is image submit button, isnt it

Yes, one way of doing it.

;;;may i know the function code

Sure.
BTW: 'submitForm' was a random name, this can be called anything.
Thre are two things you could do:
1.. onClick="Javascript:formName.submit();"
Would submit the form to the destination indicated in the action property of the <form> tag (no actual function needed as submit() is a function).

2.. This is the option I use for several reasons. You may want to validate or based on certain values etc direct the user to a different location(s) to the page indicated in the <form> tag, pass certain queryStrings based on some JS prompts/answers etc...

Anyhow:
onClick="someJSFunctionName();"
Now in the head of your document:
<script>
   function someJSFunctionName(someVar)
   {
       //do validation, change action location or what ever here then:
       formName.submit();
   }
</script>

Wind is your friend
Matt
 
Old January 8th, 2005, 10:30 PM
Authorized User
 
Join Date: Dec 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey matt, for example like this below
<head>
<script>
   function submitform()
   {
       //do validation, change action location or what ever here then:
       test.submit();
   }
</script></head>

<form action="test.asp" name="test" method="post"
<input type="image" value="search" src="img/go.gif" width="48" height="25" border="0" onclick="submitForm();" style="cursor:hand" name="search" align="absbottom">
</form>
is that right? plz made the correct ones.
btw u said "//do validation, change action location or what ever here then:"
so we can change action location beside at <form action="test.asp" ......> right?
how to write this code? thxx matt

 
Old January 9th, 2005, 05:50 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;is that right?

Yes, looks good to me except for:
<form action="test.asp" name="test" method="post"
should be
<form action="test.asp" name="test" method="post">
If you were wanting to 'only submit the form' you would do it in line on the onClick event:
onClick="Javascript:test.submit();"

;;;so we can change action location

test.action = 'someOtherPage.asp?name=someValue';



Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide button image aware Javascript How-To 2 September 26th, 2006 05:34 PM
Make a image button as default submit button toshi ASP.NET 1.0 and 1.1 Basics 1 June 1st, 2006 05:25 AM
image as button hosefo81 HTML Code Clinic 2 February 11th, 2004 03:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.