johannes Posted March 18, 2015 Share Posted March 18, 2015 Hello Processwire community, I am currently writing a configurable Textformatter module. For the configuration page I need a dynamic set of options, each consisting of two fields like so: Option: name1:value1 name2:value2 and so on… At the moment I am using a JSON string in a text field but I was wondering if there is a better way to do this? Ideally I would be able to use a repeater, but I think that's not possible for a module configuration page, correct? What's the best way to achieve this? Link to comment Share on other sites More sharing options...
Wanze Posted March 18, 2015 Share Posted March 18, 2015 Hi johannes and welcome! If you only need to store key-value pairs, ProcessWire often uses a simple textarea where each line corresponds to a key/value pair. In your code, you can get the keys/values by using PHP's explode function (newline as a delimiter). Another possibility would be to dynamically create a new input field when clicking a button, but this requires some javascript to work. I don't think that you can use an existing inputfield, but I might be wrong 1 Link to comment Share on other sites More sharing options...
johannes Posted March 19, 2015 Author Share Posted March 19, 2015 Thank you, that sounds good, I'll give that a try. The person configuring the module is the developer in most cases anyway, so it doesn't need to be that user friendly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now