Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Question on <required>XML directive</required>

    Scheduled Pinned Locked Moved webGUI
    6 Posts 2 Posters 4.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rcarr
      last edited by

      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>

      1 Reply Last reply Reply Quote 0
      • S
        sullrich
        last edited by

        Not sure I follow.  Simply define required in each area.

        1 Reply Last reply Reply Quote 0
        • R
          rcarr
          last edited by

          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>

          1 Reply Last reply Reply Quote 0
          • S
            sullrich
            last edited by

            In those cases you need custom validation.  Take a peek at the openvpn package that does this.

            /usr/local/pkg/openvpn*

            1 Reply Last reply Reply Quote 0
            • R
              rcarr
              last edited by

              Ah!  I will check it out.  Thanks!

              1 Reply Last reply Reply Quote 0
              • R
                rcarr
                last edited by

                Something like what's going on in…

                openvpn.xml:

                <custom_php_command_before_form>...</custom_php_command_before_form>

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.