i have set up my form so that the logic part is
primarily in my main page and i use and include
statement to call a content template as required.
everything works fine when i use the include
methodology. the form displays as it should and does
exactly what it should.
however, when i create a function to replace the
include and define the function as the contents of the
include template (with added "?>" and "<?php" tags to
account for any switches to html), everything works
dandy - except the form. it does not display.
i define all my form variables in the main page and
then use the callback function and "addtype" calls in
the template.
does anyone know why the include approach would work
great but that the function approach stalls on the
form?
tia...
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
Hello,
on 02/12/2005 02:59 AM idiroddi said the following:
> How do you use db results as option values in Select fields.
You need query the database and retrieve the values and their names to
build an associative array with the pairs of options values.
For instance lets say you want to pick one user from a list retrieved
from a database:
$result=database_query($connection,"SELECT id, name FROM users WHERE
somecondition=true");
$options=array(""=>"Select an user");
while($row=database_fetch_row($result))
$options[$row[0]]=$row[1];
$form->AddInput(array(
"TYPE"=>"select",
"NAME"=>"users",
"ID"=>"users",
"VALUE"=>"",
"OPTIONS"=>$options,
"LABEL"=>"<u>U</u>ser",
"ACCESSKEY"=>"U"
));
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Hello,
on 02/10/2005 06:51 PM operationsengineer1@... said the following:
>
> before allowing data to interact with a database, one
> should prepare the data to make sure it will be stored
> in the database correctly and prevent malicious
> behavior.
>
> in php, there are functions like
>
> addslashes()
> htmlspecialchars()
> htmlentities()
>
> help address these issues.
>
> in adodb, qstr() implements a method that makes
> addslashes() unnecessary.
>
> does manuel's form class have any functions that
> handle this type of data manipulation or should i rely
> on php and adodb to do this?
For presenting values in the forms, the forms class already uses
HtmlEntities() to output HTML tag attribute values and data.
Escaping text strings for use in database queries is specific to each
type of database. AddSlashes is not the correct solution for all
databases for escaping text strings from values submited with the forms.
I do not use ADODB. I use Metabase. It has a function named
GetTextFieldValue for properly formatting and escaping text values if
necessary. For other types of database fields there are other functions.
It can also use prepared queries, which implicitly escape any type of
values when needed.
Please read Metabase documentation sections on Data type conversion and
Prepared queries if you want to know more about this:
http://www.phpclasses.org/metabase
If you use ADODb, that function may be appropriate for escaping text
values. I don't know about other datatypes.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
before allowing data to interact with a database, one
should prepare the data to make sure it will be stored
in the database correctly and prevent malicious
behavior.
in php, there are functions like
addslashes()
htmlspecialchars()
htmlentities()
help address these issues.
in adodb, qstr() implements a method that makes
addslashes() unnecessary.
does manuel's form class have any functions that
handle this type of data manipulation or should i rely
on php and adodb to do this?
tia...
__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250
--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
> Hello,
>
> on 02/09/2005 04:40 PM counter intelligence said the following:
> > No I have not changed the templates (form.tpl, header.tpl,
footer.tpl,
> > formerror.tpl).
>
> It is hard to tell without further examination. If the input field is
> not added to the form output when the AddFunction is called and you
have
> not changed the original example files, I suspect that for some reason
> Smarty is not successfully processing the templates. It may be due to
> permissions of the template files.
>
> What you can do to check whether the form output was composed properly
> is to output the form object parts variable like this:
> var_dump($subscription->parts);
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
It turns out that it was a permissions problem. The template files
were not readable by apache. D'oh!
Thanks for taking the time to help me with this. Now I can finally
start using your software!
Regards,
Marc M
Hello,
on 02/09/2005 04:40 PM counter intelligence said the following:
> No I have not changed the templates (form.tpl, header.tpl, footer.tpl,
> formerror.tpl).
It is hard to tell without further examination. If the input field is
not added to the form output when the AddFunction is called and you have
not changed the original example files, I suspect that for some reason
Smarty is not successfully processing the templates. It may be due to
permissions of the template files.
What you can do to check whether the form output was composed properly
is to output the form object parts variable like this:
var_dump($subscription->parts);
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Hello Manuel,
No I have not changed the templates (form.tpl, header.tpl, footer.tpl,
formerror.tpl).
The email section of the template looks like this:
<tr>
<th align="right">{label for="email"}:</th>
<td>{input name="email"}</td>
{if isset($verify.email)}<td>{$mark}</td>
{/if}
</tr>
>From: Manuel Lemos <mlemos@...>
>Reply-To: forms-dev@yahoogroups.com
>To: forms-dev@yahoogroups.com
>Subject: Re: [forms-dev] Re: problem testing smarty form
>Date: Tue, 08 Feb 2005 21:55:30 -0200
>
>Hello,
>
>on 02/08/2005 02:46 PM simian187 said the following:
> > OK nothing wrong with Smarty - but here's where it fails in
> > forms.php:
> > Function AddFunction($arguments)
> >
> > Called in test_smarty_form.php:
> > $subscription->AddFunction(array(
> > "Function"=>"PageLoad",
> > "Type"=>"focus",
> > "Element"=>(count($verify) ? Key
> > ($verify) : "email")
> > ));
> >
> >
> > Here's the output of print_r($this->inputs[$input]);
> >
> > Array ( [NAME] => email [ID] => email [ValidateAsEmail] => 1
> > [ClientValidate] => 1 [ServerValidate] => 1 [ValidationErrorMessage]
> > => It was not specified a valid e-mail address [TYPE] => text
> > [MAXLENGTH] => 100 [Capitalization] => lowercase [LABEL] => E-mail
> > address [ACCESSKEY] => E [SubForm] => )
> >
> >
> > But on line 1096 of forms.php, there is the following if statement:
> >
> > if(IsSet($this->inputs[$input]["InputElement"]) &&
> > strcmp($this->inputs[$input]["InputElement"],""))
> >
> >
> > and if that fails that's where you get the error:
> > "it was not specified a valid named form element to define a
> > function",$name
> >
> > $name being PageLoad.
> >
> > So where Does InputElement get set?
>
>This means that the input field element specified in the AddFunction
>call is not present in the form output definition. It seems that either
>you have not added the specified input field to the form, or you are
>using a different or changed template for the form body that does not
>contain in the specified input field, which by default is email.
>
>Have you changed the form input definitiions, or changed the example
>templates, or you are using different templates?
>
>--
>
>Regards,
>Manuel Lemos
>
>PHP Classes - Free ready to use OOP components written in PHP
>http://www.phpclasses.org/
>
>PHP Reviews - Reviews of PHP books and other products
>http://www.phpclasses.org/reviews/
>
>Metastorage - Data object relational mapping layer generator
>http://www.meta-language.net/metastorage.html
Hello,
on 02/08/2005 02:46 PM simian187 said the following:
> OK nothing wrong with Smarty - but here's where it fails in
> forms.php:
> Function AddFunction($arguments)
>
> Called in test_smarty_form.php:
> $subscription->AddFunction(array(
> "Function"=>"PageLoad",
> "Type"=>"focus",
> "Element"=>(count($verify) ? Key
> ($verify) : "email")
> ));
>
>
> Here's the output of print_r($this->inputs[$input]);
>
> Array ( [NAME] => email [ID] => email [ValidateAsEmail] => 1
> [ClientValidate] => 1 [ServerValidate] => 1 [ValidationErrorMessage]
> => It was not specified a valid e-mail address [TYPE] => text
> [MAXLENGTH] => 100 [Capitalization] => lowercase [LABEL] => E-mail
> address [ACCESSKEY] => E [SubForm] => )
>
>
> But on line 1096 of forms.php, there is the following if statement:
>
> if(IsSet($this->inputs[$input]["InputElement"]) &&
> strcmp($this->inputs[$input]["InputElement"],""))
>
>
> and if that fails that's where you get the error:
> "it was not specified a valid named form element to define a
> function",$name
>
> $name being PageLoad.
>
> So where Does InputElement get set?
This means that the input field element specified in the AddFunction
call is not present in the form output definition. It seems that either
you have not added the specified input field to the form, or you are
using a different or changed template for the form body that does not
contain in the specified input field, which by default is email.
Have you changed the form input definitiions, or changed the example
templates, or you are using different templates?
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Hello,
on 02/08/2005 01:04 PM simian187 said the following:
> It appears that the smarty_prefilter_form routine is not called in
> this block:
>
> $smarty->register_prefilter("smarty_prefilter_form");
> $smarty->fetch("form.tpl");
> $smarty->unregister_prefilter("smarty_prefilter_form");
The pre-filter is only called when the template is compiled. When you
call fetch(), the pre-filter has already been executed.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- In forms-dev@yahoogroups.com, "simian187" <mmauger_san@h...>
wrote:
>
> --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
> > Hello,
> >
> > on 02/07/2005 09:56 PM simian187 said the following:
> > > I have not been able to succesfully run the
test_smarty_form.php
> > > script. I get the form page, but only the title, and
> header "Test
> > > for Manuel Lemos' PHP form class". The rest of the page is
> blank.
> > > At the beginning, there is the following text:
> > > PageLoad: it was not specified a valid named form element to
> define
> > > a function
> > >
> > > I'm not really sure what is wrong, maybe the fetch("form.tpl")
> is
> > > not working?
> > >
> > > I'm using the lastest version as well as the latest Smarty:
2.6.7
> >
> > I have tested the example with that version of Smarty and it
works
> fine.
> >
> > Usually the error that you mentioned happens when you change the
> form
> > script and remove or rename the form input that is specified in
> the call
> > to the AddFunction function in the example. That call is
necessary
> to
> > give the input focus to a certain input when the page is loaded.
> >
> > The default input that gets the focus is the email input. If you
> changed
> > or removed that field, the error above should appear. If that is
> your
> > problem, you can either change the AddFunction call to set the
> focus to
> > some other input of your test form, or just remove the
AddFunction
> call
> > and also remove the ONLOAD attribute that calls a Javascript
> function
> > named PageLoad() in the BODY attribute of the page template.
> >
> > --
> >
> > Regards,
> > Manuel Lemos
> >
> > PHP Classes - Free ready to use OOP components written in PHP
> > http://www.phpclasses.org/
> >
> > PHP Reviews - Reviews of PHP books and other products
> > http://www.phpclasses.org/reviews/
> >
> > Metastorage - Data object relational mapping layer generator
> > http://www.meta-language.net/metastorage.html
>
> It appears that the smarty_prefilter_form routine is not called in
> this block:
>
> $smarty->register_prefilter("smarty_prefilter_form");
> $smarty->fetch("form.tpl");
> $smarty->unregister_prefilter("smarty_prefilter_form");
>
> I put debug output in prefilter.form.php, and found that it is
> loaded properly with require(), but is never called.
> I will have to debug Smarty to find out why fetch() is not
> processing the template.
>
> I will let you know what I find out.
OK nothing wrong with Smarty - but here's where it fails in
forms.php:
Function AddFunction($arguments)
Called in test_smarty_form.php:
$subscription->AddFunction(array(
"Function"=>"PageLoad",
"Type"=>"focus",
"Element"=>(count($verify) ? Key
($verify) : "email")
));
Here's the output of print_r($this->inputs[$input]);
Array ( [NAME] => email [ID] => email [ValidateAsEmail] => 1
[ClientValidate] => 1 [ServerValidate] => 1 [ValidationErrorMessage]
=> It was not specified a valid e-mail address [TYPE] => text
[MAXLENGTH] => 100 [Capitalization] => lowercase [LABEL] => E-mail
address [ACCESSKEY] => E [SubForm] => )
But on line 1096 of forms.php, there is the following if statement:
if(IsSet($this->inputs[$input]["InputElement"]) &&
strcmp($this->inputs[$input]["InputElement"],""))
and if that fails that's where you get the error:
"it was not specified a valid named form element to define a
function",$name
$name being PageLoad.
So where Does InputElement get set?
--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
> Hello,
>
> on 02/07/2005 09:56 PM simian187 said the following:
> > I have not been able to succesfully run the test_smarty_form.php
> > script. I get the form page, but only the title, and
header "Test
> > for Manuel Lemos' PHP form class". The rest of the page is
blank.
> > At the beginning, there is the following text:
> > PageLoad: it was not specified a valid named form element to
define
> > a function
> >
> > I'm not really sure what is wrong, maybe the fetch("form.tpl")
is
> > not working?
> >
> > I'm using the lastest version as well as the latest Smarty: 2.6.7
>
> I have tested the example with that version of Smarty and it works
fine.
>
> Usually the error that you mentioned happens when you change the
form
> script and remove or rename the form input that is specified in
the call
> to the AddFunction function in the example. That call is necessary
to
> give the input focus to a certain input when the page is loaded.
>
> The default input that gets the focus is the email input. If you
changed
> or removed that field, the error above should appear. If that is
your
> problem, you can either change the AddFunction call to set the
focus to
> some other input of your test form, or just remove the AddFunction
call
> and also remove the ONLOAD attribute that calls a Javascript
function
> named PageLoad() in the BODY attribute of the page template.
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
It appears that the smarty_prefilter_form routine is not called in
this block:
$smarty->register_prefilter("smarty_prefilter_form");
$smarty->fetch("form.tpl");
$smarty->unregister_prefilter("smarty_prefilter_form");
I put debug output in prefilter.form.php, and found that it is
loaded properly with require(), but is never called.
I will have to debug Smarty to find out why fetch() is not
processing the template.
I will let you know what I find out.
Hello,
on 02/07/2005 09:56 PM simian187 said the following:
> I have not been able to succesfully run the test_smarty_form.php
> script. I get the form page, but only the title, and header "Test
> for Manuel Lemos' PHP form class". The rest of the page is blank.
> At the beginning, there is the following text:
> PageLoad: it was not specified a valid named form element to define
> a function
>
> I'm not really sure what is wrong, maybe the fetch("form.tpl") is
> not working?
>
> I'm using the lastest version as well as the latest Smarty: 2.6.7
I have tested the example with that version of Smarty and it works fine.
Usually the error that you mentioned happens when you change the form
script and remove or rename the form input that is specified in the call
to the AddFunction function in the example. That call is necessary to
give the input focus to a certain input when the page is loaded.
The default input that gets the focus is the email input. If you changed
or removed that field, the error above should appear. If that is your
problem, you can either change the AddFunction call to set the focus to
some other input of your test form, or just remove the AddFunction call
and also remove the ONLOAD attribute that calls a Javascript function
named PageLoad() in the BODY attribute of the page template.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
I have not been able to succesfully run the test_smarty_form.php
script. I get the form page, but only the title, and header "Test
for Manuel Lemos' PHP form class". The rest of the page is blank.
At the beginning, there is the following text:
PageLoad: it was not specified a valid named form element to define
a function
I'm not really sure what is wrong, maybe the fetch("form.tpl") is
not working?
I'm using the lastest version as well as the latest Smarty: 2.6.7
Thanks for any help or pointers
-Marc
how do i generate a select box with let's say 90 options? like a
"select country".
and how do i insert records to database.
do i have to write custome code after "if($doit){" or is there an
easier way?
thanks,
alp
Hello,
On 10/16/2004 03:10 AM, fchang wrote:
> I have noticed a documentation error as well. The documentation
> states that the AddInput function takes
> parameter "ReplaceExpressions" to perform input value
> transformations; however, the actual code is looking
> for "ReplacePatterns" instead. Thus, if you pass
> in "ReplaceExpressions" as the input arry to the AddInput function,
> the transformation does not work.
Ah, right. I have just fixed that now. Thanks for the notice.
> Also, is it possible to turn off client side transformation even if
> the browser has Javascript enabled?
Not yet. I will add an option for the next release.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Hi Manuel,
Thanks. The new version now works!
I have noticed a documentation error as well. The documentation
states that the AddInput function takes
parameter "ReplaceExpressions" to perform input value
transformations; however, the actual code is looking
for "ReplacePatterns" instead. Thus, if you pass
in "ReplaceExpressions" as the input arry to the AddInput function,
the transformation does not work.
Also, is it possible to turn off client side transformation even if
the browser has Javascript enabled?
Thanks.
--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
> Hello,
>
> On 10/13/2004 03:30 AM, fchang wrote:
> > Going back to my sample project, I was supplying a specific
input
> > name when calling the WasSubmitted function. The NAME attribute
was
> > also supplied when adding the submit input to the form.
> >
> > I further checked the class file which had the following header:
> >
> > $Header: /home/mlemos/cvsroot/forms/forms.php,v 1.165 2004/07/14
> > 08:39:47 mlemos Exp $
> >
> > and the IsSetValue function is defined as the following:
> >
> > Function IsSetValue($variable,$file)
> > {
> > global $HTTP_POST_FILES,$HTTP_POST_VARS,$HTTP_GET_VARS;
> >
> > return(($file ? IsSet($HTTP_POST_FILES[$variable]) : (IsSet
> > ($HTTP_GET_VARS[$variable]) || IsSet($HTTP_POST_VARS
[$variable])))
> > || IsSet($GLOBALS[$variable]));
> > }
> >
> > which does not check for the $_POST and $_GET super globals.
> >
> > I may be missing something simple here since I am still fairly
new
> > to the PHP world. I would appreciate any additional insight you
may
> > provide into this issue.
>
> Now that you mentioned it, I realized that I have changed that
last
> month but did not upload the updated version. I just did it now.
Please
> check it in the PHP Classes site. Thank you for reporting.
>
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
>
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
$$$Provide SAP install CD and SAP course !
Start u SAP consultant study from here!!!!!
if u want to know detail,Pls kindly email to
erphouse@... ,erphouse£Àhotmail.com or
erphouse@... ,erphouse£Àlycos.com or
erphouse@... ,erphouse£Àhotpop.com
(because yahoogroup will hide the email,so i write 2 email id)
i can give u any files to prove i have these material!
we can help u install these SAP production !!
SAP stuff listed:
SAP R/3 4.6c ACADEMY TRAINING COURSE all module(TFIN,TSCM,TAFI,TACO,TAMM,TAPP
etc.) for all TA**
SAP R/3 4.6C standard course(ABAP,BC**,AC**,LO**,HR**etc) for each course!!
TFIN(10 12 14 30 32),TSCM(50 52 54 60 62 64)
Full BW3**,SEM***,CRM***,APO*** course
BW305/BW310/BW315/BW330/BW340/BW350/BW360/BW365
SAP BW3.1 IDES(include SEM3.2) install disk 10CD
SAP 4.6D IDES install disk 11CD
SAP BW3.1 install disk 10CD
SAP R/3 4.7 enterprise 10CD install Disk
SAP license generator tool
SAP APO3.1 install disk 8CD
SAP APO3.1 IDES install disk 10CD
SAP CRM3.0B install disk 8CD
SAP CRM3.0 IDES install disk 14CD
SAP SRM2.0/EBP3.5 IDES install disk 10CD
SAP EnterprisePortal6.0 install disk 10CD
SAP CBT Training CD(all module)2 CD
SAP R/3 4.6C 10CD install Disk
Web Application Server 6.20 install Disk 3 CD
Solution Manager3.1 install Disk 8 CD
ValueSAP (ASAP)2.1 install Disk 2 CD
Oracle 11i 10.7.5 For Nt install Disk 23CD
Oracle 11i all official training course 330course
PeopleSoft install disk
Baan install disk
Sieble7.5 install disk
JDE install disk
i can give u any files to prove i have these material!
we can help u install these SAP production !!
if u want to know detail,Pls kindly email to
erphouse@... ,erphouse£Àhotmail.com or
erphouse@... ,erphouse£Àlycos.com or
erphouse@... ,erphouse£Àhotpop.com
(because yahoogroup will hide the email,so i write 2 email id)
Hello,
On 10/13/2004 03:30 AM, fchang wrote:
> Going back to my sample project, I was supplying a specific input
> name when calling the WasSubmitted function. The NAME attribute was
> also supplied when adding the submit input to the form.
>
> I further checked the class file which had the following header:
>
> $Header: /home/mlemos/cvsroot/forms/forms.php,v 1.165 2004/07/14
> 08:39:47 mlemos Exp $
>
> and the IsSetValue function is defined as the following:
>
> Function IsSetValue($variable,$file)
> {
> global $HTTP_POST_FILES,$HTTP_POST_VARS,$HTTP_GET_VARS;
>
> return(($file ? IsSet($HTTP_POST_FILES[$variable]) : (IsSet
> ($HTTP_GET_VARS[$variable]) || IsSet($HTTP_POST_VARS[$variable])))
> || IsSet($GLOBALS[$variable]));
> }
>
> which does not check for the $_POST and $_GET super globals.
>
> I may be missing something simple here since I am still fairly new
> to the PHP world. I would appreciate any additional insight you may
> provide into this issue.
Now that you mentioned it, I realized that I have changed that last
month but did not upload the updated version. I just did it now. Please
check it in the PHP Classes site. Thank you for reporting.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Hi Manuel,
I had originally posted this question on freshmeat.net but I thought
that it would be better served if I move the thread to this forum
since others may benefit from your advice as well.
My original question was:
"I'm running Php 5.0 with Register_Globals = Off. I seem to have a
problem when calling the $form->WasSubmitted function. The function
keeps returning a null string even though the form was submitted
previously. It seems that the IsSetValue method makes uses of
globals.
Is this class certified for Php 5.0 with register_globals off? If
not, any suggestions on how we might be able to make it work?
Thanks in advance for your input."
Your reply on freshmeat.net was:
"No, the IsSetValue function also checks the $_POST and $_GET
variables, so there is no reason for it not work as intended.
I suspect that you are not specifying a specific input name for the
WasSubmitted function to check and that makes it traverse all the
form fields to determine which submit button was used.
In this case, it only works if the submit inputs in your form set
the NAME attribute. Otherwise the class does not have a reliable way
to determine whether the form was submitted.
If this is your problem, just define the NAME attribute of your form
submit inputs."
Going back to my sample project, I was supplying a specific input
name when calling the WasSubmitted function. The NAME attribute was
also supplied when adding the submit input to the form.
I further checked the class file which had the following header:
$Header: /home/mlemos/cvsroot/forms/forms.php,v 1.165 2004/07/14
08:39:47 mlemos Exp $
and the IsSetValue function is defined as the following:
Function IsSetValue($variable,$file)
{
global $HTTP_POST_FILES,$HTTP_POST_VARS,$HTTP_GET_VARS;
return(($file ? IsSet($HTTP_POST_FILES[$variable]) : (IsSet
($HTTP_GET_VARS[$variable]) || IsSet($HTTP_POST_VARS[$variable])))
|| IsSet($GLOBALS[$variable]));
}
which does not check for the $_POST and $_GET super globals.
I may be missing something simple here since I am still fairly new
to the PHP world. I would appreciate any additional insight you may
provide into this issue.
Thanks again for all your help.
Francis
--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@a...> wrote:
> Hello,
>
> On 09/14/2004 06:15 PM, rola_51 wrote:
> >
> > I use an image to bring a popup window with a calendar. I found
that
> > an image defined as
> > $frmProy->AddInput(array(
> > "TYPE"=>"image",
> > "ID"=>"image_CalFin",
> > "SRC"=>"../js/img/CAL.GIF",
> > "ALT"=>"Calendario-fin",
> > "ONCLICK"=>"calFin.popup()"
> > )
> > ));
> > triggers a form SUBMIT, which is not the intended behviour. If I
> > replace the image with a button, everything works fine. Is there
a
> > way to inhibit the form submission via image clicks?
> >
> > Thanks for any suggestion...
>
> Just define the ONCLICK attribute like this:
>
> "ONCLICK"=>"calFin.popup(); return false;"
>
>
The problem with this solution is that, if I have two or more such
images on my form, or click twice on the image, I get the re-
submission prompt, which may be confusing to the users.
I ended up with this (not very clean, but working) solution:
"ONCLICK"=>"calIni.popup();form_submitted=false;return false;"
Regards and thanks again.
Hello,
On 09/14/2004 06:15 PM, rola_51 wrote:
>
> I use an image to bring a popup window with a calendar. I found that
> an image defined as
> $frmProy->AddInput(array(
> "TYPE"=>"image",
> "ID"=>"image_CalFin",
> "SRC"=>"../js/img/CAL.GIF",
> "ALT"=>"Calendario-fin",
> "ONCLICK"=>"calFin.popup()"
> )
> ));
> triggers a form SUBMIT, which is not the intended behviour. If I
> replace the image with a button, everything works fine. Is there a
> way to inhibit the form submission via image clicks?
>
> Thanks for any suggestion...
Just define the ONCLICK attribute like this:
"ONCLICK"=>"calFin.popup(); return false;"
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
I use an image to bring a popup window with a calendar. I found that
an image defined as
$frmProy->AddInput(array(
"TYPE"=>"image",
"ID"=>"image_CalFin",
"SRC"=>"../js/img/CAL.GIF",
"ALT"=>"Calendario-fin",
"ONCLICK"=>"calFin.popup()"
)
));
triggers a form SUBMIT, which is not the intended behviour. If I
replace the image with a button, everything works fine. Is there a
way to inhibit the form submission via image clicks?
Thanks for any suggestion...
Hello Pavel,
Your end ISP mail.ru is rejecting messages sent by my server, so I am
replying here in the hope that you get this message.
On 09/10/2004 07:34 AM, Pavel Shershnev wrote:
> Hello Manuel,
>
> I have a little problem, possibly a bug.
>
> I'm making a form with labels and error messages in Russian
> (windows-1251) and the form looks and works fine except one
> little thing, the JavaScript alerts for errors show up in
> gibberish.
>
> this is what I wanted
> "ValidationErrorMessage"=>"Ââåäèòå ïàðîëü!",
>
> this is what I get
>
alert(unescape('%C2')+unescape('%E2')+unescape('%E5')+unescape('%E4')+unescape('\
%E8')+unescape('%F2')+unescape('%E5')+'
'+unescape('%EF')+unescape('%E0')+unescape('%F0')+unescape('%EE')+unescape('%EB'\
)+unescape('%FC')+'!')
Hummm... it seems that unescape turns characters into ISO-8859-1 instead
of the page encoding. Can you please send me a test script that uses the
class so I can try to reproduce and fix the problem?
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Hello,
On 08/11/2004 07:20 PM, Albert Padley wrote:
>>>I need to validate that at least 1 of the 5 selects has a value
>>>selected that is not "N/A". In other words, 4 may contain "N/A", but
>>>at
>>>least one has to have a time selected. Can this be done? If so, how?
>>
>>That kind of validation is very specific. You need use
>>ValidateServerFunction and ValidateClientFunction, or maybe write a
>>custom input plug-in class that takes care of the validation and also
>>the presentation. Given that your inputs are similar, this last option
>>probably makes more sense, especially if you plan to reuse the same
>>kind
>>of input grouping in different forms.
>>
>
> Thanks for pointing out the second option. I'll take a look, but I
> don't think I currently have the skills to pull that off.
Yes, it requires a little learning before you can create your own custom
inputs. If you plan to reuse that kind of inputs, it may be worth
investing some time on that because it will take less time to deploy
them in multiple forms.
OTOH, you may also find ValidateServerFunction a little limiting as it
only passes the current field value. You need to use global variables to
get the values of the other fields. That would be another motivation to
invest on custom input.
If you would like to consider it, most of the work may have already been
done in the example custom input class for taking dates with 3 selects
for day, month and year. What you want is very similar despite the
context is different. You may probably adapt the custom date input class
to implement your own input group type. Just let me know if you would
like further help on this.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
On Aug 11, 2004, at 3:42 PM, Manuel Lemos wrote:
> Hello,
>
> On 08/11/2004 05:16 PM, Albert Padley wrote:
>> I have a form that has 5 identical selects - one for each day of the
>> week. An example:
>>
>> $fieldform->AddInput(array(
>> "TYPE"=>"select",
>> "NAME"=>"monday_start",
>> "ID"=>"monday_start",
>> "VALUE"=>"N/A",
>> "SELECTED"=>"N/A",
>> "SIZE"=>1,
>> "OPTIONS"=>array(
>> "N/A"=>"N/A",
>> "4:30"=>"4:30 or earlier",
>> "5:00"=>"5:00",
>> "5:30"=>"5:30",
>> "6:00"=>"6:00",
>> "6:30"=>"6:30",
>> "7:00"=>"7:00",
>> "7:30"=>"7:30",
>> ),
>> "LABEL"=>"Start Time",
>> ));
>>
>> I need to validate that at least 1 of the 5 selects has a value
>> selected that is not "N/A". In other words, 4 may contain "N/A", but
>> at
>> least one has to have a time selected. Can this be done? If so, how?
>
> That kind of validation is very specific. You need use
> ValidateServerFunction and ValidateClientFunction, or maybe write a
> custom input plug-in class that takes care of the validation and also
> the presentation. Given that your inputs are similar, this last option
> probably makes more sense, especially if you plan to reuse the same
> kind
> of input grouping in different forms.
>
Thanks for pointing out the second option. I'll take a look, but I
don't think I currently have the skills to pull that off.
Albert
Hello,
On 08/11/2004 05:16 PM, Albert Padley wrote:
> I have a form that has 5 identical selects - one for each day of the
> week. An example:
>
> $fieldform->AddInput(array(
> "TYPE"=>"select",
> "NAME"=>"monday_start",
> "ID"=>"monday_start",
> "VALUE"=>"N/A",
> "SELECTED"=>"N/A",
> "SIZE"=>1,
> "OPTIONS"=>array(
> "N/A"=>"N/A",
> "4:30"=>"4:30 or earlier",
> "5:00"=>"5:00",
> "5:30"=>"5:30",
> "6:00"=>"6:00",
> "6:30"=>"6:30",
> "7:00"=>"7:00",
> "7:30"=>"7:30",
> ),
> "LABEL"=>"Start Time",
> ));
>
> I need to validate that at least 1 of the 5 selects has a value
> selected that is not "N/A". In other words, 4 may contain "N/A", but at
> least one has to have a time selected. Can this be done? If so, how?
That kind of validation is very specific. You need use
ValidateServerFunction and ValidateClientFunction, or maybe write a
custom input plug-in class that takes care of the validation and also
the presentation. Given that your inputs are similar, this last option
probably makes more sense, especially if you plan to reuse the same kind
of input grouping in different forms.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
I have a form that has 5 identical selects - one for each day of the
week. An example:
$fieldform->AddInput(array(
"TYPE"=>"select",
"NAME"=>"monday_start",
"ID"=>"monday_start",
"VALUE"=>"N/A",
"SELECTED"=>"N/A",
"SIZE"=>1,
"OPTIONS"=>array(
"N/A"=>"N/A",
"4:30"=>"4:30 or earlier",
"5:00"=>"5:00",
"5:30"=>"5:30",
"6:00"=>"6:00",
"6:30"=>"6:30",
"7:00"=>"7:00",
"7:30"=>"7:30",
),
"LABEL"=>"Start Time",
));
I need to validate that at least 1 of the 5 selects has a value
selected that is not "N/A". In other words, 4 may contain "N/A", but at
least one has to have a time selected. Can this be done? If so, how?
Thanks.
Albert Padley
Hello,
On 08/02/2004 02:19 PM, Sean wrote:
> I suppose now that this forum has been created, I'll transplant some
> of the posts from the PHPclasses forums? I would like to nail down my
> attempts at building a confirmation page where the user can go back
> and edit his entries or confirm.
Sure, go ahead.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
I suppose now that this forum has been created, I'll transplant some
of the posts from the PHPclasses forums? I would like to nail down my
attempts at building a confirmation page where the user can go back
and edit his entries or confirm.