Login Retreive lost passwordRegister
Search

Forum Index / Feedback / Suggetions to Version 1.2.7

[ This topic is solved ]

  Thomas Branius 30 November 08 / 12:29  
Changed at 30 November 08 / 12:34
In my opinion captcha field should be emptied, if the formular is not correct.

Code:
<?
    
function CaptchaField(
    
$title,
    
$name,
    
$size      null,
    
$maxlength null,
    
$extra     null)
    {
        require_once(
FH_INCLUDE_DIR.'fields/class.TextField.php');

        
// create the field
        
$fld = new TextField($this$name);
        
$fld->setValidator'FH_CAPTCHA' );
        if(!empty(
$size))      $fld->setSize$size );
        if(!empty(
$maxlength)) $fld->setMaxlength$maxlength );
        if(!empty(
$extra))     $fld->setExtra$extra );

        
$this->AddLine'<img src="'FH_FHTML_DIR .'securimage/securimage_show.php?sid='.md5(uniqid(time())).'" id="fhcaptchaimage" align="absmiddle" />' );

        
// register the field
        
$this->_registerField$name$fld$title );

        if (!
$this->isCorrect())
            
$this->setValue($name""true);
    }
?>


Another question:
If you don't use the standart mask, the captcha field can be at wrong position. Why there is no funtion to change FH_LINE_MASK which is used in captcha field?

  Johan Wiegel (Admin) 30 November 08 / 14:34  
Showing an empty field when it's not correct is a good point.
I'll alter that in a next release.

Altering the addLine by a function is something we will think about.
For now I changed the manual pointing out that CapthaField uses Addline and the posibility to alter the FH_LINE_MASK in the config file.

  Johan Wiegel (Admin) 30 November 08 / 15:10  
I changed the way FormHandler places the image of the captcha fiedl.
It now uses the imagebutton function to place the image.
That way the correct mask is used.

  Thomas Branius 02 December 08 / 08:33  
Changed at 02 December 08 / 08:35
Bugfixing Captchfield:
In my opinion the require in the captcha-validator is not correct. Can it be possible you have to write:
<?
require(FH_INCLUDE_DIR 'FHTML/securimage/securimage.php');
?>


Another point:
It is not possible to use 2 captachfields in one form (I also don't know who needs :-) ). The require in validator-class causes a fatal error. I repaired the error by replacing by 'require_once'. But validator fails!

My solution:
<?
function CaptchaField(
$title,
$name,
$size      null,
$maxlength null,
$extra     null)
{
    static 
$onlyOneCaptcha true;
    if (
$onlyOneCaptcha)
    {
        
$onlyOneCaptcha false;
        require_once(
FH_INCLUDE_DIR.'fields/class.TextField.php');

        
// create the field
        
$fld = new TextField($this$name);
        
$fld->setValidator'FH_CAPTCHA' );
        if(!empty(
$size))      $fld->setSize$size );
        if(!empty(
$maxlength)) $fld->setMaxlength$maxlength );
        if(!empty(
$extra))     $fld->setExtra$extra );
            
        
$this->ImageButtonFH_FHTML_DIR .'securimage/securimage_show.php?sid='.md5(uniqid(time())),null,'onclick="return false;" style="cursor:default;"' );

        
// register the field
        
$this->_registerField$name$fld$title );
        
        
// empty the field if the value was not correct.
        
if (!$this->isCorrect())
        {
            
$this->setValue($name""true); 
        }
    }
    else
        
trigger_error(
        
"Only one captchafield in a form",
        
E_USER_WARNING
        
);
}
?>

  Johan Wiegel (Admin) 02 December 08 / 10:02  
 Quote: Thomas Branius
 
Bugfixing Captchfield:
In my opinion the require in the captcha-validator is not correct. Can it be possible you have to write:
<?
require(FH_INCLUDE_DIR 'FHTML/securimage/securimage.php');
?>


No, see this toppic: http://www.formhandler.net/topic/5291/Small_bug_when_placing_the_FHTML_dir_in_other_path.html

 Quote: Thomas Branius
 

Another point:
It is not possible to use 2 captachfields in one form (I also don't know who needs :-) ). The require in validator-class causes a fatal error. I repaired the error by replacing by 'require_once'. But validator fails!


Good point didn't test that. time for a bugfix.

  Thomas Branius 03 December 08 / 22:43  
Changed at 03 December 08 / 22:44
 Quote: Johan Wiegel
 
[...]
No, see this toppic: http://www.formhandler.net/topic/5291/Small_bug_when_placing_the_FHTML_dir_in_other_path.html


Hello, I'm again. Using the FH_FHTML_DIR in the require-statement is not correct. The FH_FHTML_DIR is a url-link to the folder, NOT a link on the filesystem!

All require-statements in FH exclude editor-field works with FH_INCLUDE_DIR, which is set by
<?
define
('FH_INCLUDE_DIR'dirname(__FILE__).'/');
?>

and that is a filesystem link.

You should to replace
<?
fh_conf
('FH_FCK_DIR'FH_INCLUDE_DIR 'FHTML/FCKeditor/');
?>

by
<?
fh_conf
('FH_FHTML_INCLUDE_DIR'FH_INCLUDE_DIR 'FHTML/');
?>


in config.inc.php

And then use it like:

class.Validator.php
<?
...
function 
FH_CAPTCHA$value )
{
    require(
FH_FHTML_INCLUDE_DIR 'securimage/securimage.php');
...
?>


AND

class.Formhandler.php
<?
...
function 
editor(...)
{
    require(
FH_FHTML_INCLUDE_DIR 'FCKEditor/fckeditor.php');
...
?>


If anyone want to place the FHTML-folder beneath your web-root, he have to change the values FH_FHTML_DIR and FH_FHTML_INCLUDE_DIR.

And another little bugfix for captachefield:
Change if-statement to:
<?
if ($this->isPosted() && !$this->isCorrect())
?>

  Johan Wiegel (Admin) 04 December 08 / 07:33  
Thomas,

you are correct about the includes.
I'll change that in the next FH release / or bugfix

The other part
<?
if ($this->isPosted() && !$this->isCorrect())
?>


I changed that last night in my development envirement.

thanx again for sharing your thoughts about FH with us.

  Johan Wiegel (Admin) 24 February 09 / 15:14  
added in FH3 v2.1.8

  Top


powered by PHP-GLOBE   © 2004 - 2012 FormHandler. All rights reserved.   -   Open source license