Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

question about formgenerator and -validator-plugin

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
cmi
Smarty n00b


Joined: 14 Jan 2004
Posts: 1

PostPosted: Wed Jan 14, 2004 4:25 pm    Post subject: question about formgenerator and -validator-plugin Reply with quote

Hi,

I hope somebody can help me with my problem. I tried the formgenerator/-validator-plugin the first time today and this class is amazing.

But I have one problem. How can I determine a field to be optional, but IF something is entered it must have the correct syntax. E.g. if somebody enters his phone number, it has to be a number. But if he doesn't enter anything there, it must be okay too.

If I enter it in this way

Code:

$form->AddInput(array(
      "TYPE"=>"text",
      "NAME"=>"phone",
      "ID"=>"phone",
      "ReplacePatterns"=>array( // replace
         "[^0-9]"=>""
      ),      
      "ValidateAsInteger"=>1,
      "ValidationErrorMessage"=>"It was not specified a valid phone number",
      "MAXLENGTH"=>15,
      "SIZE"=>20,
      "ONCHANGE"=>"if(value.toLowerCase) value=value.toLowerCase()"
   ));


the script is requesting an input here Sad

Can somebody help me with this? Thank you!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP