checkbox on the detail page

blindmime
@blindmime
11 years ago
772 posts
I'm working on a site where I don't want profile users updating item information accept one checkbox field which I would like accessed on the detail page.

Is this possible?
updated by @blindmime: 05/30/14 08:45:19AM
michael
@michael
11 years ago
7,806 posts
Its possible, but you would need to build it yourself.

put the checkbox into the item_details.tpl page, then process it via ajax sent to your custom module for the updating part of whatever it updates.
blindmime
@blindmime
11 years ago
772 posts
I've got a checkbox field in jrFile called "file_approved". What you're saying is I could put this in the jrFile item_details.tpl and then create an extra module with the task of processing that?
michael
@michael
11 years ago
7,806 posts
your asking me to build it, then tell you how I did it? ;)

There are many ways to do it. The way that first jumps to mind is to put a jquery event onto the checkbox eg:
http://stackoverflow.com/questions/6017558/checkbox-checked-or-unchecked-with-jquery-and-mysql

Then post that to a processor in a module:
your-site/checkboxchecker/update

then build a module called:
bmCheckboxchecker

That controls the url 'checkboxchecker'.

When the checkbox is checked that url will be called via ajax and you can do whatever processing you need to do.

Return the result via json_encode() to update the page visually.

Its a little bit fiddly but totally doable.

The standard way would be for the user to open the jrFile form and check the checkbox then click update.

Tags