Question on <required>XML directive</required>
-
In tinydns_domains.xml (and elsewhere), you can indicate that a certain field MUST be filled out by the user by including the <required>tag, like:
<field><fieldname>hostname</fieldname>
<fielddescr>Hostname or FQDN (e.g.: www.exampledomain.com)</fielddescr>
<description>The DNS server will supply Records for the Fully Qualified Domain Name that is enteredription>
<required><type>input</type>
<size>35</size></required></description></field>What if you have two fields and one – either one -- must be filled in. Is there a way to indicate that?</required>
-
Not sure I follow. Simply define required in each area.
-
Take a tinydns record, for instance:
&domain:field1:field2
It isn't mandatory that you supply field1. It isn't mandatory that you supply field2. But Tinydns requires you to supply one or both of the fields.
With the <required>XML tag, I can instruct the GUI to make sure the user fills in field1 or I can instruct the GUI to make sure the user fills in field2. But how do I get the GUI to make sure the user fills in one of those two fields, without specifying which one?</required>
-
In those cases you need custom validation. Take a peek at the openvpn package that does this.
/usr/local/pkg/openvpn*
-
Ah! I will check it out. Thanks!
-
Something like what's going on in…
openvpn.xml:
<custom_php_command_before_form>...</custom_php_command_before_form>