You are here: Smarty: Checkbox Validation « PHP Programming Language « IT news, forums, messages
Smarty: Checkbox Validation

Posted by ev45ive on 09/10/06 15:38

Hi!

I have smth. like this:

file.php:
<?php

SmartyValidate::connect($smarty);
//SmartyValidate::register_form('register');

$smarty->assign('nl_id',0);
$smarty->assign('nl_sel',$Fnewsletter);
$smarty->assign('nl_name','Fnewsletter');
$smarty->assign('pp_id',0);
$smarty->assign('pp_sel',$pp);
$smarty->assign('pp_name','Fnewsletter');


if(SmartyValidate::is_valid($_POST) == true) {
// Register

} else {
// Form displayed with hints ex. "You forget e-mail"
$smarty->assign($_POST);
$smarty->display("register_form.tpl");
}

?>

Theme.tpl


{$duplikacja_usera}
<p>{validate field="Flogin" criteria="notEmpty" message=" Podaj
login "}</p>
<p>{validate field="Fhaslo" criteria="notEmpty" message=" Podaj
hasL,o "}</p>
<p>{validate field="Fhaslo" criteria="isEqual"
field2="Fhaslorepeat" message=" HasL,o nie zgadza się z
powyLLszym "}</p>
<p>{validate field="Fimie" criteria="notEmpty" message=" Podaj imie
"}</p>
<p>{validate field="Fnazwisko" criteria="notEmpty" message=" Podaj
nazwisko "}</p>
<p>{validate field="Fmail" criteria="isEmail" message=" Podaj
poprawny e-mail "}</p>
<p>{validate field="Fulica" criteria="notEmpty" message=" Podaj
ulice "}</p>
<p>{validate field="Fnumer" criteria="notEmpty" message="Podaj
numer domu "} </p>
<p>{validate field="Fkod" criteria="notEmpty" message=" Podaj kod
pocztowy "}</p>
<p>{validate field="Fmiasto" criteria="notEmpty" message=" Podaj
miasto "}</p>
<BR>
<form name="register" onsubmit="return check(this)"
action="index.php/mode/register" method="POST">
<input type="hidden" name="akcja" value="rejestruj">
<input type="text" name="Flogin" value="{$Flogin}" maxlength="20"
class="login_in" style="width:150px"></div>
<input type="password" name="Fhaslo" maxlength="20" class=""
class="login_in" style="width:150px"></div>
<input type="password" name="Fhaslorepeat" maxlength="20" class=""
class="login_in" style="width:150px">
<input type="text" name="Fimie" value="{$Fimie}"
maxlength="20" class="login_in" style="width:150px">
<input type="text" name="Fnazwisko"
value="{$Fnazwisko}" maxlength="100" class="login_in"
style="width:150px">
{validate field="Fnazwisko" criteria="notEmpty"
message=" Podaj nazwisko "}</div>

{html_checkboxes name="Fnewsletter" values=$nl_id
selected=$nl_sel}

{html_checkboxes name="pp" values=$pp_id
selected=$pp_sel}


<input type="submit" value="Rejestruję się"
style="background-color: #e9e9e9;">


How to check that "pp" checkbox is selected, and if it is - how to make
it still sellected after sobmitting when form is not valid..??

PLZ, answer quickly..

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация