I am working on a plugin that allows a user to select from several options. I have a page with a form and the plugin. When the form submits, the controller saves the form data but also needs to record the option selected in the plugin. How can this be done?
My current method is to use jquery. The plugin stores the selected value in a hidden div with a unique id. On submit the main page copies the value of the hidden div to a hidden form field, and the value is provided within the form data. I have this working as a proof of concept using just a simple, one- field plugin. However, I foresee creating more complex plugins which might have many fields. Using jquery gets messy. Is there a better way to handle that? Have the plugin store data in a database table? How can the controller identify the record? Store data as session data? Any suggestions appreciated.