Support

  1. renzo.rucco
  2. General
  3. Tuesday, July 08 2014, 11:56 AM
Hello,
I need to limit the maximum number of options chosen in a field of type CheckBoxList. For example in the attached image there are a number of options to choose: I would limit to a maximum of three choices. Is it possible?
Thanks a lot.
Renzo
Attachments (1)
admin Accepted Answer
Admin
Sorry, but Easy Profile not have this feature. We add this to our TODO list, is a great feature.;)

You may add some Javascript to do this.
Example (tested and work) add this javascript code to your template or script file
jQuery(document).ready(function($){
$('#jform_alias_of_field input').change(function(){
if($('#jform_alias_of_field input:checked').length==3)
{
$('#jform_alias_of_field input:not(:checked)').attr('disabled','disabled');
}
else
{
$('#jform_alias_of_field input').removeAttr('disabled');
}
});
});


if your field have alias "keywords" replace "jform_alias_of_field" with "jform_keywords"

With this when you have set 3 option, the function disable other options
  1. more than a month ago
  2. General
  3. # 1
renzo.rucco Accepted Answer
Exactly where i must insert this code? In the master template of my web site?
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Yes, you can insert this into some js file of your template (at the end of file).

If you send me your site link I can tell you which file.

You can insert also into our js file /components/com_jsn/assets/js/name.js but if you update easy profile you lost the modification.
  1. more than a month ago
  2. General
  3. # 3
renzo.rucco Accepted Answer
There is another problem.
Suppose that during the first compilation of profile, we have select three options. Properly others are disabled. But if you return to the edit profile and add one new option, this to me is granted. I can even select them all and save. How can I avoid this problem?
Thanks
Renzo
  1. more than a month ago
  2. General
  3. # 4
admin Accepted Answer
Admin
ok,
try this code:
jQuery(document).ready(function($){
$('#jform_alias_of_field input').change(function(){
if($('#jform_alias_of_field input:checked').length==3)
{
$('#jform_alias_of_field input:not(:checked)').parent().css('opacity','0.6');

}
else if($('#jform_alias_of_field input:checked').length>3)
{
$(this).removeAttr('checked');
}
else
{
$('#jform_alias_of_field input:not(:checked)').parent().css('opacity','1');
}
});
$('#jform_alias_of_field input').change();
});


I have found another problem with chrome HTML5 validation.:D
  1. more than a month ago
  2. General
  3. # 5
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.