Reputation: 431
There are two links on jsp page, which have common javascript function func1 as handler of their onclick events. func1 submits form, which contains both links. Submitting form courses redirect to some servlet. func1 looks like:
function func1(someValue, form)
{
getElementById('someId').value = someValue;
getElementById(form).submit();
}
The matter is since Mozilla FireFox 18-version: submit() in func1 still works only for one link and does not work for another.
Adding alert() after submit() in func1 solved the problem.
HOW TO make submit() work without adding alert()?
P.S.: Adding setTimeout(), “return false” to func1; cache-parameter to submit() function; name, value-attributes to form-element in jsp - page did not make any effort.
Upvotes: 2
Views: 162
Reputation: 1818
uhm... maybe this not help you buy... you have try to add to your func1 te event object? end prevent the default behavior?
html:
<!-- ...html... --> onClick="func1(someValue, form, event)" <!-- ...html... -->
js:
function func1(someValue, form, event)
{
event.preventDefault();
getElementById('someId').value = someValue;
getElementById(form).submit();
}
maybe can help...
Upvotes: 1