Inserts a <button> entity to submit a specific form with optional random confirmation.
The following parameters are recognized:
The ID of the form to be submitted - if you omit then you need to add your own custom onclick handler.
Label to appear on button (defaults to "Submit").
Optional title attribute to appear as a tooltip to the user when their mouse hovers over the button.
Optional set of attributes to apply to the button entity. entity.
Add Optional javascript random confirmation dialog. A positive confirmation will submit the form otherwise abort.
This macro allows one to insert a <button> into the HTML output with an onclick attribute that will submit a form with the specified ID. If the ID is omitted, it is assumed that you will be providing your own onclick handler.
Example of using the macro:
@wuiButtonSubmitRandomConfirm("myform","Process My Data","Click this to process your data",,"Are your sure?")
Assuming the com.ccg.macros.at.All
class is within your CLASSPATH
and the
config/html.at
macros file has been
generated (Hint: run make atmacros in the
wui
directory), a developer should be able to
run the above example by copy/pasting from below:
[root@probe root]#
java com.ccg.macros.at.All <<EOF
@include("config/html.at",,"d")
@wuiButtonSubmitRandomConfirm("myform","Process My Data","Click this to process your data",,"Are your sure?")
EOF
This macro is defined as:
@htmlEntity("button","@fnb("@param(1)","Submit") ","@ifEqual("@param(0)",,," @htmlAttr("onclick","@ifEqual("@param(4)",,"getElementById('@param(0)').submit();"," var props = { message: '@param(4)', title: 'Text Confirmation Dialog', confirmed: function(self) { getElementById('@param(0)').submit(); } }; NstWui.randomConfirm2(props); ")")") @htmlAttr("class","wuiInputButton") @toolTipAttr("@param(2)")@param(3)")