Welcome Guest, Not a member yet? Register   Sign In
replacing checkboxes with images
#1

[eluser]bibiki[/eluser]
Hey there,
could someone guide me on how to replace checkboxes with images. I want users to be able to make their selections based on images they see instead of checking as <input type='checkbox'/> makes possible.

I know I need to use javascript, but do I need to pass that javascript to form_checkbox(), or do I do that referencing some javascript file on top of my html/php file?

thank you in advance.
#2

[eluser]Mauricio de Abreu Antunes[/eluser]
Ok, do you need to click the image for this?
If not:
Code:
function checkBoxByImage(checkBoxId) {
    document.getElementById(checkBoxId).checked = "checked";
}

In your PHP loop for print images/checkbox, print the id in your image tag.
Code:
<img src="myassisburning.jpg" /> //Call javascript function here with id below
&lt;input type="checkbox" id="same_id_above" /&gt;

EDIT: sorry, editor blocked my "javascript call" Sad
#3

[eluser]CroNiX[/eluser]
http://filamentgroup.com/lab/accessible_...ss_jquery/
#4

[eluser]bibiki[/eluser]
Hey friends,
thank you for your prompt replies. This seems to be making sense. thanks again.
#5

[eluser]Mauricio de Abreu Antunes[/eluser]
Lemme know if my code example worked fine. %-P
#6

[eluser]bibiki[/eluser]
Hey Mauricio,
I just wanted to let you know that I still do not have anything working as far as this issue goes.

I thought I'd leave this for when I get to making my app pretty.

Besides, I am not sure using checkboxes is the right way to do what I am trying to do. The number of options to select will vary over time. As a result, I'd better use multiselect. However, CI's multiselect seems a little hard to use. I can not seem to make selection of more than two options possible. When I pass on to code further the selections, what I get is one option select only.

Anyways, just wanted to let you know how everything went as you asked to be informed.

Kind regards.
#7

[eluser]Mauricio de Abreu Antunes[/eluser]
Everything is easy with CI.




Theme © iAndrew 2016 - Forum software by © MyBB