Login Retreive lost passwordRegister
Search

Forum Index / Feedback / Custom Messages

[ This topic is solved ]

  Robert 06 June 05 / 18:50  
Is it planned to enable a custom message if the userdata are not entered correctly ?

for example:


    function textField(
      $title, 
      $name, 
      $validator = null, 
      $size      = null, 
      $maxlength = null, 
      $extra     = null
      <b>$CUSTOM_MESSAGE = null</b>) 
    {

  Teye Heimans (Founder) 07 June 05 / 08:08  
What do you mean with a custom message. A custom value for the field? A custom error message? A message above the field?

  Robert 07 June 05 / 08:45  
Changed at 07 June 05 / 08:47
I mean the message that will be returned if the checked value of an field is not valid.
e.g:

I use a textField called 'lastname'. If this field is not a string or empty, i want to display the message 'Please enter your lastname'.

I know this could be built with a custom validator but it would be nice to handle this in that way:


$form->textField('Last name', 'lastname', FH_STRING, 30, 50, '', 'Please enter your lastname');



Robert

  Teye Heimans (Founder) 07 June 05 / 09:10  
You can better make your own function for this:


<?php
function checkLastName($value) { 
    if( 
Validator::IsString$value ) ) {
        return 
true;
    } else {
        return 
"You have to enter a last name!";
    }
}  

?>

  bas 28 June 05 / 15:25  
I think this is a work-around instead of a real function.

Is the above thing ever going to implemented?

I would love to see it as an extra param.

  Teye Heimans (Founder) 28 June 05 / 16:14  
 Quote: bas
 
I think this is a work-around instead of a real function.

Is the above thing ever going to implemented?

I would love to see it as an extra param.


That should mean that all fields should get another parameter! Not really nice... I understeand that the code above is just a work-around, but currently its the only thing to use it. I could make a new function "setErrorMsg" so that you can attach an error message to a field...

  bas 30 June 05 / 10:27  
another function would be perfect.

  Teye Heimans (Founder) 30 June 05 / 15:50  
 Quote: bas
 
another function would be perfect.


Ok, i will add it soon...

  Teye Heimans (Founder) 05 July 05 / 15:53  
Method is added!

  johne 15 September 05 / 18:33  
Changed at 15 September 05 / 18:35
hello there. Thanks for the great software!

I too was wondering about custom messages for non-valid fields.

I tried to implement the above but I have not been aboe to get it to work.

I tried this:

$form->textField('Last name', 'lastname', FH_STRING, 30, 50, '', 'Please enter your lastname');

and the it does not seem to work. Please point me in the right direction.

Thank you!

  Teye Heimans (Founder) 16 September 05 / 14:43  
check this function: setErrorMessage

  johne 16 September 05 / 16:36  
Thanks! It works perfectly. !

johne

  Top


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