Skip to:
Content

BuddyPress.org

Changeset 7


Ignore:
Timestamp:
04/02/2008 12:48:45 AM (17 years ago)
Author:
apeatling
Message:

added clear button to radio button fields that cannot have their data removed by deselecting

Location:
trunk/bp_xprofile
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp_xprofile/bp_xprofile.classes.php

    r6 r7  
    424424    function get_edit_html($value = null)
    425425    {
     426        global $image_base;
     427       
    426428        $asterisk = '';
    427429        if($this->is_required)
     
    482484                $options = $this->get_children();
    483485               
    484                 $html .= '<div class="radio"><span>' . $asterisk . $this->name . ':</span>' . $this->message;
     486                $html .= '<div class="radio" id="field_' . $this->id . '"><span>' . $asterisk . $this->name . ':</span>' . $this->message;
    485487                for($k = 0; $k < count($options); $k++)
    486488                {
     
    500502                $html .= '<span class="desc">' . $this->desc . '</span>';               
    501503                $html .= '</div>';
     504               
     505                if(!$this->is_required) {
     506                    $html .= '<a href="javascript:clear(\'field_' . $this->id . '\');"><img src="' . $image_base . '/cross.gif" alt="Clear" /> Clear</a>';
     507                }
     508               
    502509            break;
    503510           
  • trunk/bp_xprofile/bp_xprofile.cssjs.php

    r6 r7  
    205205            }
    206206           
     207            function clear(container) {
     208                if(!document.getElementById(container)) return false;
     209               
     210                var container = document.getElementById(container);
     211               
     212                radioButtons = container.getElementsByTagName('INPUT');
     213
     214                for(var i=0; i<radioButtons.length; i++) {
     215                    radioButtons[i].checked = false;
     216                }
     217               
     218            }
     219           
    207220        </script>
    208221       
Note: See TracChangeset for help on using the changeset viewer.