Fields marked by an are mandatory
Forms
Mandatory Info 
- Class name: (k-mandatory)
- Version: 1.0
-
Tapestry Integration
Message about mandatory fields.
HTML5 Plain Code
-
<p class="k-mandatory">Fields marked by an <img src="../img/k-theme0/bg_required.svg" alt="Asterisk" /> are mandatory</p>
CSS Code
-
p.k-mandatory {
-
clear: both;
-
font: 0.8em open_sansbold, "Gill Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
-
text-align: right;
-
color: #000;
-
background: transparent;
-
padding-right: 5px;
-
margin-bottom: 1em;
-
}
IE Backward Compatibility
In order to correct display bugs for Internet Explorer versions prior to 9, your html pages need to call the following file by Conditional Comments:
Tapestry Integration
If one of your input have the required validator, the Kawwa library will add the introduction message (in the XHTML sample : "Fields marked by an ... are mandatory").
You can change the message by adding the kawwaMandatoryMessage parameter to the form component : t:kawwaMandatoryMessage="message:mandatory-field"
If you don't want to see this message on a particular Form, you can set the disableKawwaMandatory parameter to true.
The Template
-
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"
-
xmlns:p="tapestry:parameter">
-
<t:form t:clientValidation="false" t:id="form">
-
Because the following textfield is required, the default message will be displayed.
-
<t:textfield t:id="value" t:validate="required"/><br />
-
<t:submit />
-
</t:form>
-
-
<t:form t:clientValidation="false" t:id="form" t:kawwaMandatoryMessage="message:mandatory-field">
-
Tapestry will expect to find a "mandatory-field" key in your .properties files. (the page specific or the global catalogue) and will display it.
-
The value you specify for the key will be formated : '%s' caracter will automatically be replaced by the symbol configured to identify mandatory fields (* by default)
-
This means your key may look like this: mandatory-field=Fields marked by %s are mandatory
-
If you want to change the default * symbol, you can override the KawwaConstants.MANDATORY_FIELD_IMAGE symbol in your AppModule.
-
But keep in mind that the final symbol used in textfields is also defined in the CSS file (checkout Form > Required field section for more information).
-
<t:textfield t:id="value3" t:validate="required"/><br />
-
<t:submit />
-
</t:form>
-
-
-
<t:form t:clientValidation="false" t:id="form" t:disableKawwaMandatory="false">
-
The mandatory information won't be displayed.
-
<t:textfield t:id="value2" t:validate="required"/><br />
-
<t:submit />
-
</t:form>
-
</html>
Java Implementation
-
package net.atos.kawwaportal.components.test.pages;
-
import org.apache.tapestry5.annotations.Property;
-
public class Form {
-
-
@Property
-
private String value, value2, value3;
-
-
}