I have a javascript function say newFn(). I need to check some condition with if else.
function newFn(formName)
{
var codeParam = document.getElementById('code').value;
var windowForm = document.forms[formName];
windowForm.submit();
return true;
}
My requirement is :
if(codeParam == null) I need to pass one more parameter say codeParam=null else codeParam=codeParam on windowForm.submit();.In short in the url I need an extra param. Is this possible?
I don’t understand exactly what you want to accomplish but
If (assuming "code" is a textfield) is empty, codeParam is set to null, if it has a value, then codeParam is set to the value.
(i added the propertie to the form as well, so it would get submitted, i don’t know if its what you want )
You can take a look at the output of this Fiddle