Forums

A gallery with checkboxes

crn 27 May, 2015
Is it possible to add images to a form? I would like to create a gallery where the visitor could select an image via a checkbox.
GreyHead 27 May, 2015
Hi cm,

You can do that using HTML in a Custom Code elements. Check though for existing gallery extensions with this feature before building your own.

Bob
crn 11 Jun, 2015
Thanks, my best solution is to stay within Chronoforms and set up a series of Custom Code elements followed by a checkbox. I looked into other galley extensions and got lost. Now I have to figure out how to have the user select a specified number of choices. I think I saw that you already gave some direction on that in a forum.....I will investigate further ....just wanted to thank you for the help before I come knocking on your door again 🙂
GreyHead 12 Jun, 2015
Hi crn,

You can use custom JavaScript to limit the total; you can see a ChronoForm I built here. Here's the MooTools script that page uses - it would need rewriting in jQuery for Joomla! 3. Basically it runs a function when any checkbox is clicked, if the count is 5 or more it disables all the unchecked ones and shows a message; if it is less than 5 it enables then all and hides the message.
window.addEvent('domready', function() {
  var files = $$('input[name^=file_select][type=checkbox]');
  files.each(function(item) {
    item.addEvent('click', checkCount);
  });

  function checkCount() {
    var files_checked;
    files_checked = $$('input:checked[name^=file_select][type=checkbox]');
    if ( files_checked.length >= 5 ) {
      $('complete').setStyle('visibility', 'visible');
      files.each(function(el){
        if ( el.checked !== true ) {
          el.disabled = true;
        }
      });
    } else {
      $('complete').setStyle('visibility', 'hidden');
      files.each(function(el){
        el.disabled = false;
      });
    }
  }
});	

Bob
crn 12 Jun, 2015
Wow, thanks so much. This is way above my pay grade ...that's why my husband is getting involved in my struggles this weekend. He will surely appreciate this.
Thanks so much for sharing your expertise.
This topic is locked and no more replies can be posted.