fireproofsocks Posted June 3, 2013 Share Posted June 3, 2013 When developing a custom server module, the forms that are generated do not have a way to supply a different label/value for the options in a dropdown or a radio form. You can only supply a comma-separated list of values, e.g. "subscription" => array ( "FriendlyName" => "Subscription Term", "Type" => "dropdown", "Options" => "1,12,24", ), But that's no good if you want the user to see "Month", "Year", etc. This becomes really important if you need to pass unique IDs to your server API, but you need to display human readable text to your user. Does WHMcs have this ability? Seems like the form generation bit here is too simplistic... couldn't there be something more complex than simple comma-separated values? E.g. a JSON array or a semi-colon or something? 0 Quote Link to comment Share on other sites More sharing options...
And then there was one les Posted June 4, 2013 Share Posted June 4, 2013 Does something like this not work? "subscription" => array ( "FriendlyName" => "Subscription Term", "Type" => "dropdown", "Options" => array("1 Month" => 1, "12 Months" => 12,"24 Months" => 24), ), 0 Quote Link to comment Share on other sites More sharing options...
fireproofsocks Posted June 28, 2013 Author Share Posted June 28, 2013 (edited) No that doesn't work: the module settings stuff accepts only a comma-separated list of values. This should be in the docs somewhere... From the WHMcs tech support: [Key/Value pairs] is not something that is possible on the "Module Settings" tab of the product, You could have just the ID, just the name, or the ID|Name and then explode the | in the module coding. Generally, the Module Settings does not matter as only the person configuring the product would see this. It is more about the client side and what the client would see. With this, you can use configurable options and have a System Value and a Friendly Value. The system value is passed to the module whilst the friendly value is displayed to the client in the clientarea. This is done using |. This will work on the Configurable Options name and the values. For example diskspace|Disk Space would should Disk Space to the client, but diskspace in the module code. The same applies to the values of the configurable options (and custom fields). You can have an option with the value 123|New York, the client would see New York and the module would receive 123. Edited June 28, 2013 by fireproofsocks tech support answered the question. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.