K
kkuniya
Situation :
- A form (method : POST, action : itself, onsubmit : alert 'Submit' )
- Got 2 submit button ( 'Save' , 'View')
- Got navigation 1|2|3|4
What I want to do :
- Once clicked on the navigation page, it will save the page without
need to click on 'Save' button. Currently, if i manually clicked on the
'Save' button; it will save the page.
What have I done :
- tried using js form.submit(); not submitted coz no alert comes out
- tried using js button.click(); submitted coz got the alert, but it
didnt trigger the function to Save the form.
The code :
<form method="POST" name="theform" action="this page"
onSubmit="alert('submitted')">
:
:
:
<a href="thispage&p=3" onClick="submitForm()">3</a>
<a href="thispage&p=4" onClick="submitForm()">4</a>
:
<input type="submit" name="mysave" value="Save Value">
<input type="submit" name="myview" value="View Mode">
:
</form>
<script>
function submitForm() {
var theobject = document.theform.mysave
theobject.click()
}
</script>
<?php
if ($_POST['mysave']) {
....tried echo something here also not printed anything...
}
?>
May anyone help me on this?..
- A form (method : POST, action : itself, onsubmit : alert 'Submit' )
- Got 2 submit button ( 'Save' , 'View')
- Got navigation 1|2|3|4
What I want to do :
- Once clicked on the navigation page, it will save the page without
need to click on 'Save' button. Currently, if i manually clicked on the
'Save' button; it will save the page.
What have I done :
- tried using js form.submit(); not submitted coz no alert comes out
- tried using js button.click(); submitted coz got the alert, but it
didnt trigger the function to Save the form.
The code :
<form method="POST" name="theform" action="this page"
onSubmit="alert('submitted')">
:
:
:
<a href="thispage&p=3" onClick="submitForm()">3</a>
<a href="thispage&p=4" onClick="submitForm()">4</a>
:
<input type="submit" name="mysave" value="Save Value">
<input type="submit" name="myview" value="View Mode">
:
</form>
<script>
function submitForm() {
var theobject = document.theform.mysave
theobject.click()
}
</script>
<?php
if ($_POST['mysave']) {
....tried echo something here also not printed anything...
}
?>
May anyone help me on this?..