<addbutton>

Related Topics

 

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 <addbutton> tag represents the button that is displayed on the form when the user is adding a new record.

 

Use of the <addbutton> tag is optional. If not found, XMod will display a link with the caption "Add Item".

 

If your form is using a custom layout (<form format="custom">...) then you can place any number of <addbutton> tags in your form. For standard forms, only one <addbutton> tag will be recognized.

 

ATTRIBUTES:

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:

  • button - an HTML-style button will be displayed

  • imagebutton - a click-able image will be displayed. Be sure to set the imageurl attribute.

  • linkbutton - the button will be displayed as a hyperlink. This is the default value.

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.
New to Version 4.0

 

EXAMPLES:

This example might be used when creating a form to enter albums from a music collection. When the user is adding a record, the "Save Changes" link will have the text "Add A New Album" and will be given the "NormalBold" CSS class.

 

<addbutton text="Add A New Album" class="NormalBold" />

 

This example uses CSS to add a 1 pixel solid border around the link.

 

<addbutton text="Add A New Album" class="NormalBold" style="border: 1px solid red;" />

 

This example displays as a standard HTML button:

 

<addbutton text="Add A New Album" display="button"/>

 

This example displays as an image. The image will have "Add A New Album" as its alternate text.

 

<addbutton text="Add A New Album" display="imagebutton" imageurl="/images/add.gif"/>

 

If your user has Javascript enabled, you can run some script before submitting the form by adding script to the "onclick" attribute.

 

<addbutton text="Add" 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.

 

<addbutton text="Add" display="button" onclick="alert('Hello World');return false;"/>