• 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

LiquidPro

Active member
#1
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!
 

Mike

XenForo developer
Staff member
#2
It sounds like you should be putting all of those elements into a single option instead.
 

LiquidPro

Active member
#3
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>
 

Mike

XenForo developer
Staff member
#4
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.