Focal Point
help with SUBMIT syntax

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6141077331

March 17, 2004, 03:48 AM
susannah
help with SUBMIT syntax
How can i get a SUBMIT button to have a second action, to clear the target frame while the new fex is waiting to finish?
For ex, an HREF can have an OnKlick='parent.banner.location.mynewpage.htm' to load a second or third frame in addition to performing the specified href.
But i tried this within the INPUT TYPE="submit"... and it didn't work.
I tried BUTTON TYPE="submit" etc. Didn't work.
I tried OnSubmit in the FORM tag. Didn't work.
Grateful for help. thanks.
(the K in the html above is a C, but this board won't take it)A
March 17, 2004, 06:50 AM
Mikel
HTML/Javascript topic Wink

I understand you want to execute second action when first action is finished...

onsubmit must work. Try the following example.



<script type="text/javascript">
function firstAction() {
return confirm('Continue with second action?');
}
function secondAction() {
alert('Second Action');
}






1. Click the submit button
2. The form executes onsubmit (normally used for validations). onsubmit can returns true or false.
3. If onsubmit action returns true (important!) then the form executes the main action (not neccesary to be javascript like the example).

I hope this helps.
Regards,
Mikel

This message has been edited. Last edited by: <Mabel>,
March 17, 2004, 03:47 PM
susannah
thanks Mikel, but what i need is the OnClick event handler of the Submit button. the two events are not interdependent, so i don't need the onsubmit event handler of the form object...i'm not concerned with t/f on event 1;
Just concerned with clearing the page so that the user knows that the server is actually working on their request. so i'm aiming at the INPUT TYPE=submit..onKlick...but i just can't make it work with dom syntax:
[input type="submit" value="Go" onKlick="'parent.main.location="blue.htm"'>
Just doesn't work; How can i make it work???
March 18, 2004, 10:33 AM
Mikel
Susannah, the following code works:







Problem: If the target is the same for both actions, the browser start loading processing.html (onclick) but, at same time, before the processing.html load have finished, start the load of the submit action.

Regards,
Mikel

This message has been edited. Last edited by: <Mabel>,
March 19, 2004, 11:19 PM
susannah
thanks Mikel, i just can't make it work;
i get the alert boxes ok,
but i can't get the 'processing.html' to load before the fex output loads. there's plenty of time, its just the action i can't figure out.
argh! exasperated.
July 13, 2004, 06:32 PM
<slallen>
Not sure if this will help or not. Why not make your rocessing.html page the report view page as well.

I have a an application where the user makes selection then clicks a submit button. The page clears to home and a new window opens with our processing page.



SCRIPT LANGUAGE="JavaScript"
function loadReport() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
// End -->
/script


Using the layers we can load a screen with a processing message.


/HEAD
BODY OnLoad="loadReport()"
div id="hidepage"
table
tr
td align="center"
font face="Arial">Building report...Please Wait.
/font
/td
/tr
/table
/div


Then since the page continues to process all lines when loaded it will fire off the report.



script LANGUAGE="JavaScript"
window.location.href="/servlets/WFServlet?IBIF_ex=SC3060"
/script
/head
/body
/html


When completed the page will be displayed in the same window.

You can also define an Action dynamically using



function alter(object) {
var sl = document.feedback.Category.value;
var al = "../../scservlets/jsp/jmail.jsp";
object.encoding = 'text/plain';
object.action = al;
object.method = 'GET';
// parent.main.location.href = 'schome.htm';
}

Then in the Submit use


INPUT type="submit" value="Go" onClick="alter(this.form)"

This message has been edited. Last edited by: <Mabel>,