Actually, that shows that the function works. The reason it is only temporary is because submitting the form reloads the page. Javascript cannot remember from page load to page load without cookies and cookies enabled on the client side - feasible and effective for many (not nearly all) users - not a direction I think you would want to go.
If you were using get instead of post, you could (in the head):
Code:
<script type="text/javascript">
function getQval(n, m) {
/*my n=name, m=searchString(optional)*/
if(!arguments[0]||typeof n!='string')
return null;
var r=new RegExp('[?&;]'+n+'=([^&;#]*)'), m=arguments[1]?m:location.search;
return (m=r.exec(m))? unescape(m[1]) : null;
}
function disableForm(theform) {
if (document.forms) {
for (var i = 0,tempobj = theform.elements; i < tempobj.length; i++)
if (tempobj[i].type&&tempobj[i].type.toLowerCase() == "submit")
tempobj[i].disabled = 1;
}
}
</script>
And, right before the closing body tag:
Code:
<script type="text/javascript">
if(document.forms&&getQval('submitp'))
disableForm(document.forms['addjob3'])
</script>
This still requires that the user has javascript enabled, better odds than cookies, but still not 100%.
Ultimately though, since it appears that you have a PHP enabled server and are using the post method, there should be a way to do this all on the server side.
Since I am not personally well versed in PHP, I'd suggest that you take this up in the PHP forum. There should be a way to take the mere existence of the post data and translate that into serving the form with the submit button already disabled.
Bookmarks