New to Version 3.0
XMod, by default, supplies your forms with buttons (linkbuttons for those of you familiar with ASP.NET) necessary for proper function of the form such as "Save Changes" and "Cancel". XMod 3 and later allows you to customize the look and text of those buttons. The <cancelbutton> tag represents the button that is displayed on the form that allows the user to cancel any changes he/she may have made.
Use of the <cancelbutton> tag is optional. If not found, XMod will display a link with the caption "Cancel".
If your form is using a custom layout (<form format="custom">...) then you can place any number of <cancelbutton> tags in your form. For standard forms, only one <cancelbutton> tag will be recognized.
text |
Text to be displayed in the link or button. If display is "imagebutton" then this value will be the image's alternate text. [String value] |
class |
Name of the CSS Class used to style the button (Optional) [String value] |
style |
Same as the HTML style attribute. It allows you to apply CSS styling to the element (e.g. "color: red; border: solid 1px black;") (Optional). [String value] |
display |
Determines how the button will be rendered at runtime. Valid values are:
New to Version 4.0 |
imageurl |
When display is set to "imagebutton" the value of this attribute will be used to find the image to display. Any valid URL pointing to a valid image file can be used. New to Version 4.0 |
height |
Determines the height of the control at run-time using a measurement unit. New to Version 4.0 |
width |
Determines the width of the control at run-time using a measurement unit. New to Version 4.0 |
onclick |
Allows you to assign a client-side Javascript function to the button's OnClick event. If the result of the Javascript is true then the button will perform its normal functions. If the result is false the button will cancel its normal functions. Javascript must be enabled in the user's browser for this to function. |
The "Cancel" link will have the text "Cancel Changes" and will be given the "NormalBold" CSS class.
<cancelbutton text="Cancel Changes" class="NormalBold" />
This example uses CSS to add a 1 pixel solid border around the link.
<cancelbutton text="Cancel Changes" class="NormalBold" style="border: 1px solid red;" />
This example displays as a standard HTML button:
<cancelbutton text="Cancel Changes" display="button"/>
This example displays as an image. The image will have "Add A New Album" as its alternate text.
<cancelbutton text="Cancel Changes" display="imagebutton" imageurl="/images/cancel.gif"/>
If your user has Javascript enabled, you can run some script before canceling the changes by adding script to the "onclick" attribute.
<cancelbutton text="Cancel" display="button" onclick="alert('Hello World');"/>
This will prevent the form from being submitted on Javascript machines. In a real situation, you would probably call a function that checks values, performs calculations, etc. and then have that function return true or false - true to continue processing and false to cancel processing.
<cancelbutton text="Cancel" display="button" onclick="alert('Hello World');return false;"/>