Class ConfirmationTag
java.lang.Object
org.javalite.activeweb.freemarker.FreeMarkerTag
org.javalite.activeweb.freemarker.ConfirmationTag
- All Implemented Interfaces:
freemarker.template.TemplateDirectiveModel
,freemarker.template.TemplateModel
,RequestAccess
Simple confirmation tag. Will generate an HTML anchor tag with a snippet of JavaScript. When clicked, it will popup
a JavaScript confirmation message dialog before submitting a form.
Required attributes:
Required attributes:
- text - this is a message text to display in the confirmation dialog
- form - this is an ID of a form to submit in case user pressed "OK"
<@confirm text="Are you sure you want to delete post: \\\'${post.title}\\\'?" form=post.id>Delete</@confirm>
<@form controller="posts" id=post.id action="delete" method="delete">
<input type="hidden" name="id" value="${post.id}">
</@form>
The code above will generate the following HTML:
<a href="#" onClick="if(confirm('Are you sure you want to delete post: \'ActiveWeb Rocks.\'?')) { $('#' + 17).submit(); return true; } else return false;">Delete</a>
<form action="/kitchensink/posts/delete" method="post" id="17">
<input type='hidden' name='_method' value='delete' /> <input type="hidden" name="id" value="17">
</form>
- Author:
- Igor Polevoy
-
Field Summary
Fields inherited from interface org.javalite.activeweb.RequestAccess
LOGGER
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
Constructor Summary
-
Method Summary
Methods inherited from class org.javalite.activeweb.freemarker.FreeMarkerTag
execute, get, getAllVariables, getContextPath, getUnwrapped, getUnwrapped, logger, overrideContext, process, session, sessionObject, validateParamsPresence
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.javalite.activeweb.RequestAccess
appContext, context, cookie, cookies, cookieValue, exists, format, getId, getLocale, getRequestHost, getRequestPort, getRequestProperties, getRequestProtocol, getRoute, header, headers, host, ipAddress, ipForwardedFor, isDelete, isGet, isHead, isMethod, isMultipartContent, isPost, isPut, isXhr, locale, method, param, param, params, params, params, params1st, params1st, path, port, protocol, queryString, remoteAddress, remoteHost, requestHas, servletPath, session, session, uri, url, userAgent, xhr
-
Constructor Details
-
ConfirmationTag
public ConfirmationTag()
-
-
Method Details
-
render
Description copied from class:FreeMarkerTag
Implement this method ina concrete subclass.- Specified by:
render
in classFreeMarkerTag
- Parameters:
params
- this is a list of parameters as provided to tag in HTML.body
- body of tagwriter
- writer to write output to.- Throws:
Exception
- if any
-