Login Retreive lost passwordRegister
Search

Forum Index / Feedback / Autocomplete only works on first form

[ This topic is solved ]

  Recmo D. 11 August 09 / 11:00  
When using two forms on the same page the autocomplete function only works on the first form. Even when only using autocomplete on the second form it does not work.

After the first form has been displayed (with or without autocomplete) the initcode that loads javascript [autocomplete.js] and the initcode of the array is never there.

Only when completely removing the first form the second form will work properly.

<html>
<body>

<?php
    
include('FH3/class.dbFormHandler.php');
    
$ar_test=Array("aap","noot","mies");
?>


<b>testform 1</b><br>
<?php
    $form1
=new FormHandler("form1");
    
$form1->setFocus(false);

    
$form1->TextField("test1""test1"_FH_STRING30,50);
    
$form1->SetAutocomplete("test1"$ar_test);

    
$form1->flush();
?>


<hr>

<b>testform 2</b><br>
<?php
    $form2
=new FormHandler("form2");
    
$form2->setFocus(false);

    
$form2->TextField("test2""test2"_FH_STRING30,50);
    
$form2->SetAutocomplete("test2"$ar_test);

    
$form2->flush();
?>


</body>
</html>

  Remco van Arkelen (Admin) 11 August 09 / 11:26  
Changed at 11 August 09 / 11:27
Hi Remco,

Thanks for using FormHandler. I've tested your code and discovered the same bug. It's caused by a static variable $return in the function "getJavascriptCode" in class.FormHandler.php.

Removing the keyword static will correct this bug, I'll discuss the change with my collegue because it won't be there without a reason ;)

Remco

  Recmo D. 11 August 09 / 13:38  
okay, i'll do that untill the fix is there (if applicable)

*lol* another Remco ;)

  Johan Wiegel (Admin) 17 August 09 / 08:52  
Will be fixed in todays release

  Top


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