In a legacy java struts application, this code in the jsp page is working fine on Internet Explorer but not working in the Chrome & FireFox.
<a id="alertSubmit" class="button" href="#" onkeypress="" onclick="javascript:this.blur();depositNotifSubmit();">
<span>
<bean-el:message bundle="${terms}" key="label.submit"/>
</span>
<script language="javascript" type="text/javascript">
var isSubmit = false;
function depositNotifSubmit()
{
if (validateFields()) {
if(!isSubmit){
isSubmit = true;
doConfirmSubmitAction(document.depositNotifInfoForm, 'depositNotifInput.recip',
'<bean-el:message bundle="${terms}" key="popup.message.continue" />');
}
}
}
function doConfirmSubmitAction(formObj, action, message)
{
//if (formObj == null) formObj = document.generalSubmit;
if (action != null && action != "")
formObj.action = action;
if (confirm(message)){
formObj.submit();
}else{
isSubmit = false;
}
}
Expected result (working fine on Internet Explorer) :- After hitting the SUBMIT button it should prompt up a confirm box & if 'Yes' is selected, then update the changes that is written in the code not provided here.
Actual result :- Working fine in Internet Explorer, showing the confirm pp-up & pressed 'Yes' updating the values. But on Chrome & FireFox, after hitting submit, nor confirm pop-up is showing nor the values are getting updated.
Any help to get this code/scenario working on Chrome and Firefox would be appreciated. Find the actual screen-shots for the reference.
After getting the suggestion that document.depositNotifInfoForm has been deprecated & to check the browser console for the error. Attaching the screen shot of the console error for the reference.
Console error :-
depositNotifInfo.recip:1034 Uncaught TypeError: Cannot read properties of null (reading 'value')
at validateFields (depositNotifInfo.recip:1034:64)
at depositNotifSubmit (depositNotifInfo.recip:980:9)
at HTMLAnchorElement.onclick (depositNotifInfo.recip:963:147)
validateFields @ depositNotifInfo.recip:1034
depositNotifSubmit @ depositNotifInfo.recip:980
onclick @ depositNotifInfo.recip:963