Calling Submit Routine....ACK 
Author Message
 Calling Submit Routine....ACK

Hey there.

Does anyone know how to emulate a submit button function from a subroutine?
For instance, when I click on a button in a form I want to run a short
subroutine that in turn (if certain criteria are met) will submit the data
from the form to another page (as any well behaved submit button would)
My best (pathetic?) guess:

    Sub Run()
        Call document.forms.form1.submit()
    End Sub

HELP.
Nic



Mon, 16 Jul 2001 03:00:00 GMT  
 Calling Submit Routine....ACK
Hey Nic,

We have been using Javascript to cancel or redirect submits in IE4 as
follows:

//The Form Def
<form NAME="ProfileForm" METHOD="POST"
ACTION="destinationform.asp?ParmOne=0>" Language="JavaScript"
onClick="cancelLink()">            

//The Button Def
<input TYPE="submit" NAME="SubmitProfile" VALUE="Save &gt;">

//The 'cancel the submit if we want to' Routine
function cancelLink()
{
if(window.event.srcElement.name == 'SubmitProfile')
        {
        if(window.event.srcElement.value == 'Save >')
                {
                        //Set the event returnValue to false to cancel the submit.
                        if (!validateForm(document.ProfileForm))
                        {
                                //Alert to bad field validation
                                alert ('Provide all of the information requested, then select Save >');
                                window.event.returnValue = false;
                        }
                }

        }

Quote:
}

\\The validate routine, extend for each field in form
function validateForm(form)
  {
    if (isEmpty(form.txtField1)) return false;
    return true;
  }

Lot's of room for improvement but you get the idea.

Hope this helps,
RDKolb



Fri, 20 Jul 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problems with Form.Submit in validation routine

2. Calling PPT COM routine via Javascript within HTML page

3. Calling JavaScript routines

4. Calling sub routine from a FOR loop problem

5. How to Call C++ Routine

6. Calling a VB Script Routine from VB

7. Wanted economic HTML call for JS routine

8. Calling sub routine dependent on OS

9. calling a Javascript function from and asp Sub Routine

10. call external routine

11. Calling JavaScript Routines

12. Calling winsock routines

 

 
Powered by phpBB® Forum Software