Go Back  Xtreme Visual Basic Talk > Other Languages > Web Programming > help!


Reply
 
Thread Tools Display Modes
  #1  
Old 12-28-2003, 01:20 AM
kevork kevork is offline
Newcomer
 
Join Date: Dec 2003
Posts: 4
Question help!


hey guys!

the image submit button is now perfectly working except that i have a validation function onsubmit!

the form should not do the action when a "return false" is given by the onsubmit function. this works ok when usin an input type=button but it's not working with the image. the function is run but although the function returns false, the action is still being executed! what shall be done?
Reply With Quote
  #2  
Old 12-28-2003, 01:24 AM
Dunsti Dunsti is offline
Newcomer
 
Join Date: Dec 2003
Location: Germany
Posts: 18
Default

Quote:
Originally Posted by kevork
hey guys!

the image submit button is now perfectly working except that i have a validation function onsubmit!

the form should not do the action when a "return false" is given by the onsubmit function. this works ok when usin an input type=button but it's not working with the image. the function is run but although the function returns false, the action is still being executed! what shall be done?



I think you have to do this with an <img> and the "OnClick"-Funktion.


Dunsti
__________________
Greetings from Good Old Germany
Reply With Quote
  #3  
Old 12-28-2003, 04:57 AM
kevork kevork is offline
Newcomer
 
Join Date: Dec 2003
Posts: 4
Default

it's the same thing even with the <img> tag

the problem is that the action in the form is still being executed although the checkform function is returning false


here is the code

<FORM ACTION="abc.asp" METHOD="post" name="mainform" onsubmit="return checkform();">

<input>
<input>
...
...

<input type=image src=... onclick=mainform.submit()>
</form>

when there is something wrong with the form, the "return checkform()" function will return a "false" to the form and the action="abc.asp" will not be executed => we still remain on the same page....

however, in this case (i.e. using image submit instead of button submit) the action="abc.asp" is being executed nomatter what the function returns...

Last edited by kevork; 12-28-2003 at 05:02 AM.
Reply With Quote
  #4  
Old 12-28-2003, 05:42 AM
michael_hk's Avatar
michael_hk michael_hk is offline
Contributor
 
Join Date: Nov 2003
Location: Hong Kong
Posts: 690
Default

Try this

<FORM ACTION="abc.asp" METHOD="post" name="mainform" onSubmit="event.returnValue=false;">
Reply With Quote
  #5  
Old 12-28-2003, 06:39 AM
kevork kevork is offline
Newcomer
 
Join Date: Dec 2003
Posts: 4
Default

Quote:
Originally Posted by michael_hk
Try this

<FORM ACTION="abc.asp" METHOD="post" name="mainform" onSubmit="event.returnValue=false;">



i realized that the "document.mainform.submit()" function in the "onclick" event is refreshing the page...i think this refreshing of the page is causing the whole problem... is there any other way to call a submit function?
Reply With Quote
  #6  
Old 12-28-2003, 07:40 AM
Dunsti Dunsti is offline
Newcomer
 
Join Date: Dec 2003
Location: Germany
Posts: 18
Default

I din't mean to use an <INPUT TYPE="Image" ....>, I was talking about using a normal <IMG>-Tag.
When someone klicks on the image, the function "checkform()" is launched, and in this function (if it is true) the form is submittet.

Code:
<SCRIPT ...>
function checkform() {
...
...
...
if checkform=true then mainform.submit()
...
...
}
</SCRIPT>




<FORM ACTION="abc.asp" METHOD="post" name="mainform">
<input>
<input>
...
...

<img src=... onclick=checkform()>
</form>
something like this
__________________
Greetings from Good Old Germany
Reply With Quote
  #7  
Old 12-30-2003, 03:36 PM
kevork kevork is offline
Newcomer
 
Join Date: Dec 2003
Posts: 4
Default database crisis

hey guys, everything is AOK with webpage programming except that there's this major problem... I have an access database full of records, and I will keep on filling records. the problem is that I have to let others fill in records too coz I have a lot of them.. so i want a way to get all records from the other (similar) databases and put them in the original...

I have related tables, and i want all data to be accurate..

Is there a possible way to get out of this crisis?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->