PDA

View Full Version : [How to make] the poll check box checked and users cannot unchecked?


basketmen
12-27-2010, 08:36 AM
I want to make users must using poll in the threads

- in newthread template, from this tutorial http://www.hscripts.com/tutorials/html/form-checkbox.php i already can make the check box to checked, by add entry "checked" in bold below

<input type="checkbox" checked name="postpoll" value="yes" id="cb_postpoll" tabindex="1" $checked[postpoll] />





- but i still cant make the check box Non Editable/Non Selectable, so users cannot unchecked it, i already tried this from that same tutorial page its says to add entry "disabled" like below in bold

<input type="checkbox" checked disabled name="postpoll" value="yes" id="cb_postpoll" tabindex="1" $checked[postpoll] />

its working the check box being Non Editable/Non Selectable, but after click Submit new thread button, its just pass the poll options page and directed to the thread page,

its not working maybe because the check box really disabled, its just pass the checked check box, like there is no check box. Maybe using entry "disabled" is the wrong way




please help guys, how to make the checked check box still working after click Submit new thread button, but the check box are already checked and cannot unchecked by users

kh99
12-27-2010, 09:47 AM
I would have thought that disabled would work, but I don't know a whole lot about HTML. But one thing you might do is change it to type="hidden" - of course it won't show up at all, but the user won't be able to change it.

BTW, I remember this from that other thread but I wasn't sure exactly what you meant.

basketmen
12-27-2010, 03:16 PM
ok i already tried type="hidden" is not working


somebody suggest this in bold, i think this is the best way if i know how to do that, any body know how to do that in newthread template maybe?



Why do you need to show such a checkbox in this case? If it's to checked and cannot be altered, then can't you just assume the value of $postpoll as yes, in the serverside?

FYI: There's nothing permanent when it comes in the client side. Users can easily manipulate the html code from their browser using tools like firebug (http://getfirebug.com/).

kh99
12-27-2010, 03:23 PM
ok i already tried type="hidden" is not working
Hmm..ok.

somebody suggest this in bold, i think this is the best way if i know how to do that, any body know how to do that in newthread template maybe?

You could try creating a new plugin using hook location newthread_post_complete and this code:

$newpost['postpoll'] = true;


it's true that users can change the HTML so you can't use things like that for security (for instance, a while back someone wanted to stop moderators from doing certain things by removing the controls). But in this case I don't think it's that important, is it? And I'm not sure, but can't the user just exit the poll page without creating a poll?

I guess what I'm saying is that what you were doing was probably fine, if it had worked.

basketmen
12-27-2010, 06:20 PM
Hmm..ok.



You could try creating a new plugin using hook location newthread_post_complete and this code:

$newpost['postpoll'] = true;


it's true that users can change the HTML so you can't use things like that for security (for instance, a while back someone wanted to stop moderators from doing certain things by removing the controls). But in this case I don't think it's that important, is it? And I'm not sure, but can't the user just exit the poll page without creating a poll?

I guess what I'm saying is that what you were doing was probably fine, if it had worked.
many thanks, its working like a charm, gbu