1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Validate Values for Group of Options

Discussion in 'Closed Suggestions' started by LiquidPro, Mar 2, 2011.

  1. LiquidPro

    LiquidPro Active Member

    I think it would be pretty valuable to be able to validate an entire group of options. There are some sitautions which an option cannot be validated by itself, it depends on values of the other options. The example I currently have is database information. I am writing an add-in that will use another database, and I can't validate the options (host, port, username, password, database) because I can only validate one field at a time. My suggestion would be when you create the group of options, be able to enter the validation class/method on that screen.

    Does that make sense, or am I off my rocker?

    Thanks!
     
  2. Mike

    Mike XenForo Developer Staff Member

    It sounds like you should be putting all of those elements into a single option instead.
     
  3. LiquidPro

    LiquidPro Active Member

    My only practical option to put them all in one option would be to create a Zend_Config object, which having a user enter something like the information below doesn't seem to be very user friendly. Then I not only have to worry about them entering valid information, but also using proper syntax.

    Code:
    <?xml version="1.0"?>
    <configdata>
       <database>
           <adapter>pdo_mysql</adapter>
           <params>
               <host>db.example.com</host>
               <username>dbuser</username>
               <password>secret</password>
               <dbname>dbname</dbname>
           </params>
       </database>
    </configdata>
     
  4. Mike

    Mike XenForo Developer Staff Member

    Have a look at the emailTransport option, as an example of a complex option. For validation of an option, see spamThreadAction. You should be able to setup a complex option with validation as you need.
     
    LiquidPro likes this.
  5. LiquidPro

    LiquidPro Active Member

    That is a perfect substitution, thank you for the suggestion.
     

Share This Page