if checkbox checked display text in user profile?

Permalink
Hi,

I've put some extra attributes onto the registration page of my site in the way of checkboxes.

I'm looking to display some text on the profile page IF a checkbox is ticked

i.e. if checkbox 1 is ticked display "text A"
if checkbox 2 is checked display "Text B"
if checkbox 3 is unticked "text C" is hidden

IS there anyway to do this?

I guess there is some java involved to show or hide the text, but I'm a little unsure of both the java and where the code should go, as its not on the profile.php file, nor view.php, and I'm unsure how to use the form helper

I hope this makes sense and someone can help me out, it seems like a simple thing to do....but it isn't!

Thanks in advance

View Replies:
thomasducel replied on at Permalink Reply
I've had more of a dig around and have found the edit.php file

I have included this jquery

<script type="text/javascript">  
  $('#akID[19][value]').live('change', function(){
      if ( $(this).is(':checked') ) {
         $('#rec').show();
     } else {
         $('#rec').hide();
     }
 });
 </script>
<ul id="rec" style="display:none">
    <li><input id="start" name="start" size="100" type="text" class="large" value="You have been recommended........." /></li>
</ul>


My problem lies in this #ak[19][value]
I know this is some form of attribute which has returned this. What I want to know is how to tell the jquery to run on th correct name?

The code for the checkbox is returned like this
<input type="checkbox" value="1" id="lets" name="akID[19][value]" class="ccm-input-checkbox"> <span>Yes</span></label></div></div></div>


Any ideas?
jyncka replied on at Permalink Reply
jyncka
You don't need to use the "name" attribute when you select it with jquery. Using the ID or a class would work.

Try:

[code]$('#lets').live('change', function() {
//code
});

I wouldn't mess around with the form name unless you know exactly where it's posting to and how that will affect the rest of the process. Just use the ID or assign classes to the checkboxes.