[TYPO3-project-formidable] CAPTCHA renderlet reloadpic javascript issue and quick fix

Jerome Schneider typo3dev at ameos.com
Wed Dec 3 16:23:24 CET 2008


Hi Gary,
Thanks for pointing that out.
It will be fixed in revision 283, branch 2.

Best regards,
Jerome

Gary Wong a écrit :
> (Disregard if this was fixed in a newer version, but using SVN 2.0.248)
>
> I was getting a JS error when clicking reload on a captcha renderlet:
>
> <meta>
>        <name>Form</name>
>        <form formid="aform"/>
>        <debug>false</debug>
>        <displaylabels>true</displaylabels>
>        <libs>scriptaculous</libs>
> </meta>
> ... snip ...
>   <renderlet:CAPTCHA name="mycaptcha" />
>
> was creating the reloadpic javascript function like this:
>
> <script type="text/javascript">
>            function reloadpic_aform.mycaptcha(){
>                var picture = false;
>   ...
>
> and calling it like this:
>
> onclick="javascript:reloadpic_aform.mycaptcha();return false;"
>
> Can easily be fixed by patching class.tx_rdtcaptcha.php - have it 
> replace any dots (".") with ("_") when rendering JS:
>
> diff of old vs new:
>
> 113c113
> <                       function 
> reloadpic_'.$this->_getElementHtmlId().'(){
> ---
> >                       function 
> reloadpic_'.str_replace(".","_",$this->_getElementHtmlId()).'(){
>
> 136c136
> <               if ($reload) $aCaptcha["reload"] = "<a 
> title='".($reload==1?'':$reload)."' style=\"cursor:pointer\" 
> onclick=\"javascript:reloadpic_".$this->_getElementHtmlId()."();return 
> false;\"><img 
> src=\"".$this->_getPathReload(trim(strtolower($this->aElement["reloadpic"])))."\" 
> class=\"captchapic\" /></a>";
> ---
> >               if ($reload) $aCaptcha["reload"] = "<a 
> title='".($reload==1?'':$reload)."' style=\"cursor:pointer\" 
> onclick=\"javascript:reloadpic_".str_replace(".","_",$this->_getElementHtmlId())."();return 
> false;\"><img 
> src=\"".$this->_getPathReload(trim(strtolower($this->aElement["reloadpic"])))."\" 
> class=\"captchapic\" /></a>";
>
>
> etc.
>
> -gary
>
>
>
>


More information about the TYPO3-project-formidable mailing list