1
EyeKeeper
Custom Field Validation
  • 2008/1/14 17:23

  • EyeKeeper

  • Quite a regular

  • Posts: 209

  • Since: 2002/6/11


Hello!

I created a page with some custom infos I want to save in a database. The database operations are working ok but I have a doubt on how to validate fields...

I need to check if the type info such as birth date and email are valid (valid date and valid emails) but I don't know on how to do it when processing the form or leaving the field...

On a normal HTML site this can be achieved by a simple "java script" but I'm not getting any results with XOOPS forms...

Any ideias on how to get this running?

Thanks

2
phppp
Re: Custom Field Validation
  • 2008/1/14 17:44

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


Server side validation or client side?

For client side, you may consider setExtra()
or use customValidationCode

3
EyeKeeper
Re: Custom Field Validation
  • 2008/1/14 17:50

  • EyeKeeper

  • Quite a regular

  • Posts: 209

  • Since: 2002/6/11


client side... in fact it is a complementary information where the user has to enter the data by him/herself...

$formCadastro = new XoopsThemeForm(_MD_BC_EFETUAR_CADASTRO"form""cadastro.php""post"false);
    
$formCadastro->setExtra('enctype="multipart/form-data"');
    
$formCadastro->addElement(new XoopsFormText(_MD_BC_NOME'bi_nome'50255,""),true);
    
$formCadastro->addElement(new XoopsFormText(_MD_BC_SOBRENOME'bi_sobrenome'50255,""),true);

etc...

    
$formCadastro->addElement(new XoopsFormText(_MD_BC_DT_NASCIMENTO'bi_dt_nascimento'50255,''),true);
    
$formCadastro->addElement(new XoopsFormButton('''post'_MD_BC_ENVIAR'submit'));
    
$formCadastro->addElement(new XoopsFormHidden('op''gravar'));
    
$formCadastro->display();


and this info is shown under the front-end part of the site (not admin...)

btw... how can I retrieve info stored for the form to be edited?

thanks again

Login

Who's Online

447 user(s) are online (349 user(s) are browsing Support Forums)


Members: 0


Guests: 447


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits