I need to show message "Please wait Processing" on click of Submit button using a hidden DOM element which contains the message and make it visible, but the message is not showing.
My html for the form and my validate function are given below.
<form name="siteSearchForm" method=post action="<%=request.getContextPath()%>/servlet/visibilityController" onsubmit="javascript:return validate();on_load()">
<td align="center" width="10%"><input type=submit name="siteSearchSubmit" value="SUBMIT" > <input type="RESET" name="clearTN" value="RESET"></td>
</form>
I tried the below code by calling on_load
on form tag during onsubmit
but it is not showing message
<head>
<script type="text/javascript">
function on_load(){
var y = document.getElementById("txtHiddenUname");
y.type= "text";
}
</script>
</head>
<body>
<input type="hidden" id="txtHiddenUname" value="invalid input" />
</body>
Also add the following line :
Becuase the return statement will exit the function call and nothing after it will run. You would need to add it BEFORE the return.
or you can do
but your on_load function needs to return true.
Also why are you using an input to display a message? Seems like you should be using a paragraph with display none/block. javascript: is not needed in event handlers, and on_load seems like it should be called on window load, not a form submission.