Alternative for deprecated FreeMarker keywords

January 19, 2010

Some alternative for deprecated commonly used freemarker keywords


?? is the alternative of exists?
for example,
<#if something?exists>
can be written as
<#if something??>


Here are some example

Keywords Alternative
?exists ??
?if_exists !
someThing?default(anotherThing) someThing!(anotherThing)


document.forms[0].submit() is not a function

April 1, 2009

Auto submission of a form can be done by the line “document.forms[0].submit()” (if the page contains a single form) or “document.getElementById(“formId”).submit()”. But if any other element in the whole form named submit, it shows error “document.forms[0].submit() is not a function” in place of submitting the form. Suppose if one have a submit button with name=”submit” as the following code


<input onclick="submitForm();" name="submit" type="button" value="Submit" />

function submitForm() {
document.forms[0].submit();
}

This code shows the error. One can resolve the error by rewriting the button name anything else except “submit”

<input onclick="submitForm();" name="save" type="button" value="Submit" />

I am not so clear about this factor. Most probably, if any element named submit then the word submit assigned as that element in place of submit function. When you submit a form it got a button with the name submit not a function.

by: Md. Shahjalal


Follow

Get every new post delivered to your Inbox.