473,473 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Smarty: Checkbox Validation

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..

Sep 10 '06 #1
0 2795

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Richard | last post by:
I need help. I have a smarty based program that I am modifying. I have a smarty template file that consists of smarty and HTML. I need to integrate some PHP database calls into it. My problem...
2
by: M | last post by:
Hi Folks, I am trying to install Smarty using PHP 5 on a Windows XP PC using IIS v6 The following PHP File: <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head>
0
by: Matt | last post by:
geez, i've done this a million times, you'd think i could get it right. uploading to production server for a new site, and part of the head.inc that starts everything up looks like this: echo...
3
by: Earl Teigrob | last post by:
I wanted my "Terms and Conditions" Checkbox control to participate in my ASP.NET validation just like all the the other controls on the page. After some time of searching the web for an example of...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
7
by: karen987 | last post by:
The code below is for a checkbox, in a form on an asp page. I want to make it mandatory for the user to click it. The other validation statements work fine, this one causes a problem though. The...
0
by: Ned Balzer | last post by:
I posted this this morning but it never went through, so I am trying again -- apologies for the duplication if so. I need to validate several checkboxes on an asp.net 2.0 page. I don't need to...
1
by: ajaymohank | last post by:
hello friends.......... i am new to smarty. can anyone please tell me how to get the value from a dynamically generated checkbox using smarty. this is the code i used... here i am generating 10...
3
by: arty | last post by:
So basically i have a form with a action attribute set to another form, it is a survey spread among several pages and using php sessions, now im trying to validate the form with Javascript but it...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.