...
Write a business rule to make the field required.
Let's say a designer created a form from a schema that contained a non-required Text field - minOccurs = 0. The designer adds a Trigger control named tr1 and this simple rule to make the field required when the trigger control is clicked.
Here is the relevant section of the xsd:
Section |
---|
Column |
---|
| Code Block |
---|
</xsd:element>
<xsd:element minOccurs="0" name="OptionalTextNonRequiredControl" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<frevvo:displaytype>Text</frevvo:displaytype>
<frevvo:label>OptionalText<label>Non Required Control</frevvo:label>
</xsd:appinfo>
</xsd:annotation>
</xsd:element> |
|
Column |
---|
| Code Block |
---|
if(tr1.clicked){
Non_RequiredControlNonRequiredControl.required = true;
} |
Same Rule as above built with the Visual Rule Builder Image Added |
Column |
---|
| |
|
- Edit the XSD and update it in the schema's tab for that application.
...
Here is an example form.load rule where SpanishOnly is the name of the section control.
Section |
---|
Column |
---|
Code Block |
---|
| if (form.load) {
SpanishOnly.required = false;
} |
|
Column |
---|
Image Added |
|
Here is an example show/hide rule where name and age are required fields only for Spanish speaking students.
Section |
---|
spanish.value == 'yes'form.load) {
SpanishOnly.required |
| = true;
SpanishOnly.visible true;
}else {
// Must clear values in hidden fields
// Must be done BEFORE setting <section>.required=
name.value = null age.value = null;
SpanishOnly.required = false;
SpanishOnly.visible = false;
} Column |
---|
Image Added |
|
Warning |
---|
Do NOT add required palette controls into an optional schema section. The from schema section tries to validate controls inside it as if they are inside an optional section, but because the controls are from palette they are not bound to the same schema. Validation will not work as expected. If these controls are needed, update the xsd to add the controls directly to the schema. Refer to Customizing the XMLSchema for examples of common xsd customizations.
|
...