Hi,
I have an application that needs to have check-box style input, but the options to check need to come from an existing DB table.
sorry this is not possible.
In addition, I need to limit the number of check-boxes that can be checked to 3.
You can do this with Javascript.
If not, how would I go about creating a new element type that I could use in EasyProfile?
This is possible but very very complex, to create new field type you need to create a new file into folder /administrator/com_jsn/helpers/fields/typename.php based on some existing file. Basically in this file there are functions to:
- create/delete column in DB to store data
- Search features
- XML declaration for Forms
in XML declaration you need to specify field type, this field type can be a Joomla built in field type or a custom field type, if you use a custom field type you need to create model for this (this like all Joomla fields)
Easy Profile field type models are into /administrator/com_jsn/models/fields/, all these models inherit some Joomla pre-existing field model (I understand that is not clear, but there is no way to explain this in a few words)
Some Easy Profile not need a custom model because it inherit directly Joomla field type model (normally stored in /libraries/joomla/form/fields/)
You need also to create a rule for server side validation (also this come from Joomla API), we have some custom rule in folder /administrator/com_jsn/models/rule
This require many Joomla dev knowledge, not only PHP, so the most simplest way is to edit already existing fields
Or (less desired option, but possibly workable) ... with the SelectList is there any way to limit the 'Multiple selection'?
Also this require many many work, because the field type inherited by Joomla not have this feature.
I recommend you this way (to not change Easy Profile core files)
- limit the number of check-boxes with Javascript
- make a script to change options in DB, options are stored with all others parameters into table "#__jsn_fields" in column "params". Parameters are stored in JSON format so
- Load JSON string
- Transform it in array or object with json_decode function
- Change Options into array/object
- Transform in JSON string with json_encode function
- Update DB