We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9496
    • 113 Posts
    Now that I have the custom fields working, is it possible without hacking the script itself to have a custom checkbox? I am working on a photo contest, and I would like the contest manager to be able to mark winners in some fashion.

    I can get it to set up the winner column in the table using this maxigallery call on my admin template:
    [!MaxiGallery?  &manage_gallery=`2`  &admin_webgroups=`WebAdmin` &manageOuterTpl=`@FILE:assets/snippets/maxigallery/templates/manageoutertpl_admin.html` &upload_field_count=`5` &managePictureTpl=`@FILE:assets/snippets/maxigallery/templates/managepicturetpl_admin.html` &customFields=`submitted_by,winner`!]


    The &managePictureTpl I would have this:
    <label class="mgManagerLabel">Mark as Winner:</label>
    		<input type="checkbox" name="[+maxigallery.fieldnames.winner+]" value="yes" title="Mark as winner"/>
    


    And then, once the admin clicks save changes it would simply send the value of "yes" to the db, if its not checked then it would be null I think the problem has to do with the basic structure of forms, and the checkbox itself, I think I would need to convert it to an html element or add some function within the script (which is so far over my head its painful)

    If anyone’s got any ideas or could point me in the right direction I would be greatly appreciative.

    P
      • 7923
      • 4,213 Posts
      So what’s happening now with that setup?


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 9496
        • 113 Posts
        I got it working by modifying the default hide checkbox in the template, which I had originally overlooked. Obviously I like to overthink things, he he.

        <input type="checkbox" name="[+maxigallery.fieldnames.winner+]" value="yes" title="Check to mark as winner" onClick="document.editform.[+maxigallery.fieldnames.modified+].value='yes'" [+maxigallery.picture.winner:is=`yes`:then=`checked="checked"`+]/>


          • 7923
          • 4,213 Posts
          Good job with this and with the whole setup. Sounds easy to use for your end users.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."