title: How to refresh captcha image on page refresh/load?
body: <p>I want to force my site to refresh the captcha image everytime it loads, so I have a javascript method triggered with the onload() event. Here I have the following line:</p>
  
  <pre><code>document.getElementById('yw0_button').click;
  </code></pre>
  
  <p>Firebug doesn't detect any errors, and for testing purposes I have added an alert right after the displayed line, and the alert pops up each time the page is loaded. However, the image doesn't refresh! </p>
  
  <p>This is what I believe is relevant about the view file:</p>
  
  <pre><code>&lt;?php if(extension_loaded('gd')): ?&gt;
      &lt;div class="row"&gt;
          &lt;?php echo $form-&gt;labelEx($model,'verifyCode'); ?&gt;
          &lt;div&gt;
              &lt;?php
              $this-&gt;widget('CCaptcha',
                            array('showRefreshButton'=&gt;true,
                                  'buttonType'=&gt;'button',
                                  'buttonOptions'=&gt;
                                                      array('type'=&gt;'image',
                                                            'src'=&gt;"/path/images/refresh-icon.png",
                                                            'width'=&gt;30,
                                                      ),                                                            
                                  'buttonLabel'=&gt;'Refrescar imagen'),
                            false); 
              ?&gt;
              &lt;br&gt;
              &lt;?php echo $form-&gt;textField($model,'verifyCode'); ?&gt;
          &lt;/div&gt;
      &lt;div class="hint"&gt;
          Porfavor ingrese las letras como las ve en la imagen superior.
          &lt;br/&gt;No hay distincion entre minúsculas y mayúsculas.&lt;/div&gt;
      &lt;/div&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>Any ideas?</p>
  
  <hr>
  
  <p><strong>@k to the z</strong> just saw this! Yes sure, if you could help me find a more proper solution it would be awesome! This is what i believe is relevant about the view file:</p>
  
  <pre><code>&lt;?php if(extension_loaded('gd')): ?&gt;
          &lt;div class="row"&gt;
              &lt;?php echo $form-&gt;labelEx($model,'verifyCode'); ?&gt;
              &lt;div&gt;
                  &lt;?php
                  $this-&gt;widget('CCaptcha',
                                array('showRefreshButton'=&gt;true,
                                      'buttonType'=&gt;'button',
                                      'buttonOptions'=&gt;
                                                          array('type'=&gt;'image',
                                                                'src'=&gt;"/path/images/refresh-icon.png",
                                                                'width'=&gt;30,
                                                          ),                                                            
                                      'buttonLabel'=&gt;'Refrescar imagen'),
                                false); 
                  ?&gt;
                  &lt;br&gt;
                  &lt;?php echo $form-&gt;textField($model,'verifyCode'); ?&gt;
              &lt;/div&gt;
          &lt;div class="hint"&gt;
              Porfavor ingrese las letras como las ve en la imagen superior.
              &lt;br/&gt;No hay distincion entre minúsculas y mayúsculas.&lt;/div&gt;
          &lt;/div&gt;
      &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>In the controller I grant authorized users permission in the accessRules() method to the captcha action, and thats about all. Is there something else I could post?</p>