Search the web
Sign In
New User? Sign Up
forms-dev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 887 - 916 of 945   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#916 From: Manuel Lemos <mlemos@...>
Date: Tue Aug 21, 2007 9:38 pm
Subject: Re: Books
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 08/20/2007 06:41 PM Gary A Mort said the following:
> Are there any books(hardcopy) that discuss using PHP forms(this
> automated package, not forms in general).
>
> I'm rather old school and find a written book helps me gel at times.

Well, I can always take the reference manual and generate a PDF if that
would solve your problem.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#915 From: "Gary A Mort" <garyamort@...>
Date: Mon Aug 20, 2007 9:41 pm
Subject: Books
garyamort
Online Now Online Now
Send Email Send Email
 
Are there any books(hardcopy) that discuss using PHP forms(this
automated package, not forms in general).

I'm rather old school and find a written book helps me gel at times.

#914 From: Manuel Lemos <mlemos@...>
Date: Fri Aug 17, 2007 6:32 pm
Subject: Re: SubForms and Validation
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 08/06/2007 01:00 PM iav8_eh said the following:
> After reading the documentation and  related post
> <http://tech.groups.yahoo.com/group/forms-dev/message/746>  about
> subforms, I thought that simply setting the SubForm property on required
> feilds and the associated Submit button would accomplish the task.
> However, I had to insert this code to get the validation step to
> correctly skip the optional feilds:
>
> $subform = ($formType='I')? 'integer' : 'real';
> if(($error_message=$f->Validate($verify,$subform))=="") {...
> //where $formType is set based on the name of the submit button used}
>
> With this code the form behaves as expected: only the required feilds
> are validated.  Without the code, all feilds are validated regardless of
> their SubForm property setting.  Every feild in my form is a member of
> one SubForm or the other and each SubForm has one Submit button.
>
> Am I missing something?  If we must call the Validate function with the
> SubForm parameter, is there a better way to determine he SubForm in use
> besides chaecking which Submit button was used?

You can use the WasSubmitted function to determine which submit button
was used to submit the form. You just need to map submit buttons to
sub-forms.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#913 From: "iav8_eh" <iav8_eh@...>
Date: Mon Aug 6, 2007 4:00 pm
Subject: SubForms and Validation
iav8_eh
Offline Offline
Send Email Send Email
 

After reading the documentation and  related post  about subforms, I thought that simply setting the SubForm property on required feilds and the associated Submit button would accomplish the task.  However, I had to insert this code to get the validation step to correctly skip the optional feilds:

$subform = ($formType='I')? 'integer' : 'real'; 
if(($error_message=$f->Validate($verify,$subform))=="") {...
//where $formType is set based on the name of the submit button used}

With this code the form behaves as expected: only the required feilds are validated.  Without the code, all feilds are validated regardless of their SubForm property setting.  Every feild in my form is a member of one SubForm or the other and each SubForm has one Submit button.

Am I missing something?  If we must call the Validate function with the SubForm parameter, is there a better way to determine he SubForm in use besides chaecking which Submit button was used?

BTW: I just started using this excellent class: thanks very much for making it available!


#912 From: Manuel Lemos <mlemos@...>
Date: Sat Jul 7, 2007 4:32 am
Subject: Re: Please help with Checkboxes
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 07/05/2007 04:36 AM Dreamweaver said the following:
> I browsed through all the mailing list posts here and the document and
> the examples but couldn't find any real life example of how to
> retrieve, validate and save the values of checked checkboxes.
>
> I've tried to use GetCheckedState but it returns NULL, even if it
> return 1, how could i retrieve the values ? Why don't we just simple
> have a GetCheckedValue which returns an array of checked value ?

If you use the MULTIPLE attribute for a group of checkboxes with the
same NAME attribute, you can use the ValidateAsSet attribute to make the
class validate the checkbox so at least one must be set.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#911 From: "Dreamweaver" <dreaminspirer@...>
Date: Thu Jul 5, 2007 7:36 am
Subject: Please help with Checkboxes
dreaminspirer
Online Now Online Now
Send Email Send Email
 
I browsed through all the mailing list posts here and the document and
the examples but couldn't find any real life example of how to
retrieve, validate and save the values of checked checkboxes.

I've tried to use GetCheckedState but it returns NULL, even if it
return 1, how could i retrieve the values ? Why don't we just simple
have a GetCheckedValue which returns an array of checked value ?

Thanks so much,

#910 From: Manuel Lemos <mlemos@...>
Date: Sat Jun 16, 2007 7:10 am
Subject: Re: Re: Accept-charset for <form> tag
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 06/16/2007 03:08 AM Shekar C. Reddy said the following:
> Thanks, Manuel!
>
> By the way, when is the right time to set the 'encoding' attribute
> of the form? Can we set it after adding inputs and before invoking
> LoadInputValues(), Validate(), etc. safely?

AFAIK, encoding is only relevant to the browser. So you can set before
you make the forms class generate the form output.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#909 From: "Shekar C. Reddy" <zendfw@...>
Date: Sat Jun 16, 2007 6:08 am
Subject: Re: Accept-charset for <form> tag
powerobject
Offline Offline
Send Email Send Email
 
Thanks, Manuel!

By the way, when is the right time to set the 'encoding' attribute
of the form? Can we set it after adding inputs and before invoking
LoadInputValues(), Validate(), etc. safely?

Regards,




--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
>
> Hello,
>
> on 06/15/2007 09:05 AM Shekar C. Reddy said the following:
> > Manuel,
> >
> > I see no option to set the accept-charset for the generated form
tag
> > in the forms class. How do I get the class to render:
> >
> > <form accept-charset="utf-8" ...>
> >
> > to ensure well-formedness of the input.
>
> Use the ExtraAttributes class variable to set any form attributes
that
> are not supported directly by the class:
>
> http://www.meta-language.net/forms.html#66.2.13
>
>
> --
>
> Regards,
> Manuel Lemos
>
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>

#908 From: Manuel Lemos <mlemos@...>
Date: Fri Jun 15, 2007 7:53 pm
Subject: Re: Accept-charset for <form> tag
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 06/15/2007 09:05 AM Shekar C. Reddy said the following:
> Manuel,
>
> I see no option to set the accept-charset for the generated form tag
> in the forms class. How do I get the class to render:
>
> <form accept-charset="utf-8" ...>
>
> to ensure well-formedness of the input.

Use the ExtraAttributes class variable to set any form attributes that
are not supported directly by the class:

http://www.meta-language.net/forms.html#66.2.13


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#907 From: "Shekar C. Reddy" <zendfw@...>
Date: Fri Jun 15, 2007 12:05 pm
Subject: Accept-charset for <form> tag
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

I see no option to set the accept-charset for the generated form tag
in the forms class. How do I get the class to render:

<form accept-charset="utf-8" ...>

to ensure well-formedness of the input.

TIA

#906 From: Manuel Lemos <mlemos@...>
Date: Fri Jun 8, 2007 9:06 pm
Subject: Re: Re: ValidateMinimumLength with strip_tags
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 06/08/2007 10:10 AM Shekar C. Reddy said the following:
> Manuel,
>
> Yes, I thought of writing a custom class. But I guess the validation
> would be performed only on the server side as I don't know if there
> is any equivalent JavaScript function for strip_tags().

Not directly, but I think you can use Javascript regular expression
functions to remove the tags probably in one line of code.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#905 From: "Shekar C. Reddy" <zendfw@...>
Date: Fri Jun 8, 2007 1:10 pm
Subject: Re: ValidateMinimumLength with strip_tags
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

Yes, I thought of writing a custom class. But I guess the validation
would be performed only on the server side as I don't know if there
is any equivalent JavaScript function for strip_tags().

Thanks,




--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
>
> Hello,
>
> on 06/06/2007 03:44 AM Shekar C. Reddy said the following:
> > Manuel,
> >
> > How do I validate min length if the value has tags not to be
counted
> > as the actual content? I want to validate the length of the
actual
> > content after stripping all tags from the value.
>
> Currently the class is not ready to achieve that in an easy way.
>
> I think you can write a custom class that performs that kind of
> validation by stripping the tags before counting the character
limit.
>
> --
>
> Regards,
> Manuel Lemos
>
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>

#904 From: Manuel Lemos <mlemos@...>
Date: Thu Jun 7, 2007 10:24 pm
Subject: Re: ValidateMinimumLength with strip_tags
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 06/06/2007 03:44 AM Shekar C. Reddy said the following:
> Manuel,
>
> How do I validate min length if the value has tags not to be counted
> as the actual content? I want to validate the length of the actual
> content after stripping all tags from the value.

Currently the class is not ready to achieve that in an easy way.

I think you can write a custom class that performs that kind of
validation by stripping the tags before counting the character limit.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#903 From: "Shekar C. Reddy" <zendfw@...>
Date: Wed Jun 6, 2007 6:44 am
Subject: ValidateMinimumLength with strip_tags
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

How do I validate min length if the value has tags not to be counted
as the actual content? I want to validate the length of the actual
content after stripping all tags from the value.

Regards,

#902 From: Manuel Lemos <mlemos@...>
Date: Tue Jun 5, 2007 8:15 pm
Subject: Re: Select inputs with options as checkboxes
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 06/05/2007 11:46 AM Shekar C. Reddy said the following:
> Manuel,
>
> Is it possible to render a SELECT-MULTIPLE input as a div with
> checkboxes (options as checkboxes that get checked/highlighted on
> clicking) for easier selection by the users using forms class? If so,
> will you be able to create a custom class for it?

Yes, I think you can do that easily.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#901 From: "Shekar C. Reddy" <zendfw@...>
Date: Tue Jun 5, 2007 2:46 pm
Subject: Select inputs with options as checkboxes
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

Is it possible to render a SELECT-MULTIPLE input as a div with
checkboxes (options as checkboxes that get checked/highlighted on
clicking) for easier selection by the users using forms class? If so,
will you be able to create a custom class for it?

As always, thanks!

#900 From: Manuel Lemos <mlemos@...>
Date: Tue May 22, 2007 6:57 pm
Subject: PHP forms integration job
mallemos
Offline Offline
Send Email Send Email
 
Hello,

Once again I got a request to develop a small PHP application that would
use the forms class. Since I do not have the time to handle it, the
person that requested the job asked me to recommend somebody that could
do it.

If you are interested to pick the job, just mail me privately to
mlemos@... so I can forward you to the person in question.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#899 From: "Shekar C. Reddy" <zendfw@...>
Date: Fri Apr 27, 2007 6:09 am
Subject: Re: Multi-Form Pages
powerobject
Offline Offline
Send Email Send Email
 
Got it!

Thanks,



--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
>
> Hello,
>
> on 04/27/2007 01:38 AM Shekar C. Reddy said the following:
> > Manuel,
> >
> > I've just noticed that there are now two forms with the same
name -
> > one in the sidebar (rendered first) and the other in the content
> > section (rendered later) where the columns exist. I guess it is
> > failing to find the first/erroneous-column in the first form
> > (sidebar) that has just some buttons and giving up. Is there a
way
> > to give a different name to the form while doing
Fetch/FetchOutput
> > or any way to adjust the precedence-order of the forms in
> > document.forms?
>
> That is what either the NAME or ID properties are for.
>
> --
>
> Regards,
> Manuel Lemos
>
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>

#898 From: Manuel Lemos <mlemos@...>
Date: Fri Apr 27, 2007 5:49 am
Subject: Re: Re: Multi-Form Pages
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 04/27/2007 01:38 AM Shekar C. Reddy said the following:
> Manuel,
>
> I've just noticed that there are now two forms with the same name -
> one in the sidebar (rendered first) and the other in the content
> section (rendered later) where the columns exist. I guess it is
> failing to find the first/erroneous-column in the first form
> (sidebar) that has just some buttons and giving up. Is there a way
> to give a different name to the form while doing Fetch/FetchOutput
> or any way to adjust the precedence-order of the forms in
> document.forms?

That is what either the NAME or ID properties are for.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#897 From: "Shekar C. Reddy" <zendfw@...>
Date: Fri Apr 27, 2007 4:38 am
Subject: Re: Multi-Form Pages
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

I've just noticed that there are now two forms with the same name -
one in the sidebar (rendered first) and the other in the content
section (rendered later) where the columns exist. I guess it is
failing to find the first/erroneous-column in the first form
(sidebar) that has just some buttons and giving up. Is there a way
to give a different name to the form while doing Fetch/FetchOutput
or any way to adjust the precedence-order of the forms in
document.forms?

Please see the below message...

TIA



--- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@...>
wrote:
>
> Manuel,
>
> On using the same form object to render form parts with
> ResetFormParts() using different templates, I noticed the first
> column or the erroneous column is not gaining focus on page-load
> although the PageLoad() is returning a valid JS string:
>
>    document.forms[form].column.focus()
>
> In this case, I am rendering a part of the form (just buttons) on
> the sidebar (different template) before the main form (another
> template) is rendered. Is it because the form is split into two
> different templates and the main form is rendered later? How do I
> get the focus into the first/erroneous column onload?
>
> > If it is the same form, you can use different templates to render
> > each form part, and use ResetFormParts function before rendering
> > the next form part.
>
>
>
>
> --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@> wrote:
> >
> > Hello,
> >
> > on 12/15/2006 12:59 AM Shekar C. Reddy said the following:
> > > [NOT: Multi-page Forms]
> > >
> > > Manuel,
> > >
> > > Apparently, the forms class has a hard-coded var $form that is
> > > rendered in Smarty. How do I go about rendering multiple forms
> on a
> > > single page?
> > > I guess I need to be able to give different names to the form
> var...
> >
> > I am not sure what you mean.
> >
> > If the forms are different, you would better use different form
> objects.
> >
> > If it is the same form, you can use different templates to
render
> each
> > form part, and use ResetFormParts function before rendering the
> next
> > form part.
> >
> >
> > > There is a NAME attribute but how do I grab the name of the
> submitted
> > > form on the server-side? Use prefixes in submit button names?
> >
> > I guess you can use an hidden input with different values to
tell
> which
> > form page you are submitting.
> >
> >
> > --
> >
> > Regards,
> > Manuel Lemos
> >
> > Metastorage - Data object relational mapping layer generator
> > http://www.metastorage.net/
> >
> > PHP Classes - Free ready to use OOP components written in PHP
> > http://www.phpclasses.org/
> >
>

#896 From: "Shekar C. Reddy" <zendfw@...>
Date: Fri Apr 27, 2007 2:33 am
Subject: Re: Multi-Form Pages
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

On using the same form object to render form parts with
ResetFormParts() using different templates, I noticed the first
column or the erroneous column is not gaining focus on page-load
although the PageLoad() is returning a valid JS string:

    document.forms[form].column.focus()

In this case, I am rendering a part of the form (just buttons) on
the sidebar (different template) before the main form (another
template) is rendered. Is it because the form is split into two
different templates and the main form is rendered later? How do I
get the focus into the first/erroneous column onload?

> If it is the same form, you can use different templates to render
> each form part, and use ResetFormParts function before rendering
> the next form part.




--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
>
> Hello,
>
> on 12/15/2006 12:59 AM Shekar C. Reddy said the following:
> > [NOT: Multi-page Forms]
> >
> > Manuel,
> >
> > Apparently, the forms class has a hard-coded var $form that is
> > rendered in Smarty. How do I go about rendering multiple forms
on a
> > single page?
> > I guess I need to be able to give different names to the form
var...
>
> I am not sure what you mean.
>
> If the forms are different, you would better use different form
objects.
>
> If it is the same form, you can use different templates to render
each
> form part, and use ResetFormParts function before rendering the
next
> form part.
>
>
> > There is a NAME attribute but how do I grab the name of the
submitted
> > form on the server-side? Use prefixes in submit button names?
>
> I guess you can use an hidden input with different values to tell
which
> form page you are submitting.
>
>
> --
>
> Regards,
> Manuel Lemos
>
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>

#895 From: "Shekar C. Reddy" <zendfw@...>
Date: Tue Apr 10, 2007 9:10 pm
Subject: Re: Text prefixed to LABEL getting prefixed to OPTIONS display-values
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

Please ignore this post. I debugged it and noticed it is happening
due to passing data by reference.



--- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@...>
wrote:
>
> Manuel,
>
> I prefix '&nbsp;' to some inputs' LABELs for fine alignment with
the
> labels of other inputs. I have an SELECT-type input and these
space
> chars are getting prefixed to the display values of the OPTIONS
(the
> text between <option></option> tags) although I'm not even
prefixing
> the space char to this input's LABEL because none of the inputs on
> this page needs one. This is happening only with one input whose
> name is 'sort' while other similar inputs appearing after this
input
> are rendering just fine. This is the first input on the page with
a
> couple of BUTTON-type inputs above/before it and similar inputs
> after/below it:
>
>     [NAME] => sort
>     [ID] => sort
>     [TYPE] => select
>     [VALUE] => Modified
>     [OPTIONS] => Array
>         (
>             [Name] => Name
>             [Modified] => Modified
>         )
>     [STYLE] => width: 150px
>     [LABEL] => Sort
>     [ACCESSKEY] => O
>     [ValidateOptionalValue] =>
>
>
> I'm using forms class dated 2007-4-2. My code does not manipulate
> the OPTIONS array in any way. If I comment the part that prefixes
> space char to the label, the input is rendered fine. What could be
> causing these space chars to make into (prefixed to) the display
> values of the OPTIONS?
>
> TIA
>

#894 From: "Shekar C. Reddy" <zendfw@...>
Date: Tue Apr 10, 2007 8:01 pm
Subject: Text prefixed to LABEL getting prefixed to OPTIONS display-values
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

I prefix '&nbsp;' to some inputs' LABELs for fine alignment with the
labels of other inputs. I have an SELECT-type input and these space
chars are getting prefixed to the display values of the OPTIONS (the
text between <option></option> tags) although I'm not even prefixing
the space char to this input's LABEL because none of the inputs on
this page needs one. This is happening only with one input whose
name is 'sort' while other similar inputs appearing after this input
are rendering just fine. This is the first input on the page with a
couple of BUTTON-type inputs above/before it and similar inputs
after/below it:

     [NAME] => sort
     [ID] => sort
     [TYPE] => select
     [VALUE] => Modified
     [OPTIONS] => Array
         (
             [Name] => Name
             [Modified] => Modified
         )
     [STYLE] => width: 150px
     [LABEL] => Sort
     [ACCESSKEY] => O
     [ValidateOptionalValue] =>


I'm using forms class dated 2007-4-2. My code does not manipulate
the OPTIONS array in any way. If I comment the part that prefixes
space char to the label, the input is rendered fine. What could be
causing these space chars to make into (prefixed to) the display
values of the OPTIONS?

TIA

#893 From: Manuel Lemos <mlemos@...>
Date: Thu Apr 5, 2007 8:53 pm
Subject: Re: Re: Isolate JavaScript to disk-files: follow-up...
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 03/29/2007 02:12 PM Shekar C. Reddy said the following:
> By the way, I've successfully isolated JavaScript to disk-files on
> another tool I use that generates JavaScript but did not have any
> support to isolate the code to disk-files other than the ability to
> include the code inside the HTML page. While isolating JS to disk-
> files, I used caching, basically - I would check for the existence
> of all the folders in the specified path if they don't exist, I
> create them in a:
>
>    loop
>    clearstatcache();
>    if ( ! file_exists( $dir ))
>    {
>       @mkdir( $dir, 0700, true );
>       @chmod( $dir, 0700 );
>    }
>    endloop
>
> on each created folder inside the loop. Once the folders are in
> place, I generate the JavaScript (custom-generated by me to return
> it as a string):
>
>
> clearstatcache();
> if ( ! file_exists( $fileName ) || ( filemtime( $fileName ) +
> $lifeTime ) < time())
>    loop
>    // Go ahead and write to the disk-file...
>    endloop
>
> However, the code for writing to the disk-file is a bit complicated
> which I borrowed from Zend_Cache_Backend_File. It includes calls to
> fopen/flock/fwrite/flock/fclose/touch with mkdir/chmod for any
> failures. Thought this might save you some time on not reinventing
> the wheel or testing the code.
>
> Please see my FOLLOW-UP message on "caching" below...

There is no need for using another generic caching component to
implement caching mechanism.

I have developed a mature generic caching class a long time ago:

http://www.phpclasses.org/filecache

Anyway, that is just for separate cache stored. In the case of the forms
class Javascript, it will not be stored separately. The class will
generate a Javascript file that your scripts will include directly using
<script src=...>  tags.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#892 From: Manuel Lemos <mlemos@...>
Date: Thu Apr 5, 2007 8:48 pm
Subject: Re: Re: Isolate JavaScript into disk-files
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 03/26/2007 10:41 PM Shekar C. Reddy said the following:
> During development, the developer sets the life-time to a very high
> frequency such as every one hour. Any life-time greater than 0 would
> mean to validate file-existence, compare file-time with life-time
> for stale files and re/generate file if expired/missing. The
> developer can also blow off the JavaScript files anytime to
> regenerate them before their expiry or use configuration logic to
> reset the life-time to refresh the files. Typically, its much easier
> to manipulate configuration/files on dev environment.
>
> Whereas on production, life-time is usually set to 0 which means
> cache files never expire. The class would only validate for the
> existence of the JavaScript file and would always generate if it is
> missing but would never validate the file-times. When we copy
> stabilized code from development into production or update the forms
> class, all we need to do is blow off the related JavaScript files or
> run a script to do it so they get generated on next page-load by
> default. The overhead is too low with this approach. Even if we set
> the life-time to 24 hours (just in case), they get generated only
> once in a day.
>
> class form_class
> {
>    function form_class( $javaScriptFile, $lifeTime = 0 );
> }
>
>    $form = new Form_Class( $javaScriptFile, $lifeTime );
>
>
> Do you think it is ideal to offer caching as an additional feature -
> when you are on it?

I do not see the need for the life time cache check. I may just add an
option to generate the Javascript only if it does not exist and it would
not check for dependency files.


> Further, since this is a major change, you may like to increment the
> major version of the form_class.

Since I do not intend to implement backwards incompatible changes, there
is no point in changing the class major version. Actually the version
number that you see is automatically generated by CVS.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#891 From: "Shekar C. Reddy" <zendfw@...>
Date: Thu Mar 29, 2007 5:12 pm
Subject: Re: Isolate JavaScript to disk-files: follow-up...
powerobject
Offline Offline
Send Email Send Email
 
By the way, I've successfully isolated JavaScript to disk-files on
another tool I use that generates JavaScript but did not have any
support to isolate the code to disk-files other than the ability to
include the code inside the HTML page. While isolating JS to disk-
files, I used caching, basically - I would check for the existence
of all the folders in the specified path if they don't exist, I
create them in a:

    loop
    clearstatcache();
    if ( ! file_exists( $dir ))
    {
       @mkdir( $dir, 0700, true );
       @chmod( $dir, 0700 );
    }
    endloop

on each created folder inside the loop. Once the folders are in
place, I generate the JavaScript (custom-generated by me to return
it as a string):


clearstatcache();
if ( ! file_exists( $fileName ) || ( filemtime( $fileName ) +
$lifeTime ) < time())
    loop
    // Go ahead and write to the disk-file...
    endloop

However, the code for writing to the disk-file is a bit complicated
which I borrowed from Zend_Cache_Backend_File. It includes calls to
fopen/flock/fwrite/flock/fclose/touch with mkdir/chmod for any
failures. Thought this might save you some time on not reinventing
the wheel or testing the code.

Please see my FOLLOW-UP message on "caching" below...





--- In forms-dev@yahoogroups.com, "Shekar C. Reddy" <zendfw@...>
wrote:
>
> Manuel,
>
> Thanks much for considering this exciting feature implementation!
I
> hope you would address any derived extensions of the form_class
> (descendants) by the developer while implementing it.
>
> Could we discuss a little bit more on the caching mechanism? I did
> not mean the developer would end up using outdated JavaScript
files
> by using caching. As you are aware, caching is "automatic" and
> powerful which is used by several major frameworks and classes
such
> as Smarty.
>
> During development, the developer sets the life-time to a very
high
> frequency such as every one hour. Any life-time greater than 0
would
> mean to validate file-existence, compare file-time with life-time
> for stale files and re/generate file if expired/missing. The
> developer can also blow off the JavaScript files anytime to
> regenerate them before their expiry or use configuration logic to
> reset the life-time to refresh the files. Typically, its much
easier
> to manipulate configuration/files on dev environment.
>
> Whereas on production, life-time is usually set to 0 which means
> cache files never expire. The class would only validate for the
> existence of the JavaScript file and would always generate if it
is
> missing but would never validate the file-times. When we copy
> stabilized code from development into production or update the
forms
> class, all we need to do is blow off the related JavaScript files
or
> run a script to do it so they get generated on next page-load by
> default. The overhead is too low with this approach. Even if we
set
> the life-time to 24 hours (just in case), they get generated only
> once in a day.
>
> class form_class
> {
>    function form_class( $javaScriptFile, $lifeTime = 0 );
> }
>
>    $form = new Form_Class( $javaScriptFile, $lifeTime );
>
>
> Do you think it is ideal to offer caching as an additional
feature -
> when you are on it?
>
> Further, since this is a major change, you may like to increment
the
> major version of the form_class.
>
>
>
>
>
> --- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@> wrote:
> >
> > Hello,
> >
> > on 03/22/2007 04:52 PM Shekar C. Reddy said the following:
> > > Manuel,
> > >
> > > It would be great if the forms class can manage the process of
> > > caching the JavaScript files. You quoted several issues and
> offered
> > > self-explanatory solutions to all of those except this one:
> > >
> > > "A different problem may occur to people using safe mode. In
> that
> > > case it may not be possible to creata the Javascript files due
> to
> > > safe mode permission restrictions. In that case should the
forms
> > > class Output function fail altogether and do not generate any
> forms,
> > > or silently generate the Javascript as part of the forms
output
> as
> > > it is done today?"
> > >
> > > Yes, in case of file-write errors, the class may silently
> generate
> > > the JavaScript as part of the forms output as it is done
today.
> This
> > > would be a 'generic' course of action to take.
> >
> > Yes, it sees the best solution. The class also will issue an
error
> that
> > will be trapped by the debug callback function.
> >
> >
> > > As for the 3rd-party plugins, we may have to offer some hints
on
> how
> > > to resolve/update the information in the documentation or
cover
> it
> > > in the video tutorials.
> >
> > I think it is better to fail the form output generation
altogether
> with
> > an explicit error message if any plug-ins do not implement a
> function
> > that informs its files dependencies, when Javascript file
> generation is
> > requested.
> >
> >
> > > We need to be able to specify the JavaScript file to be used
on
> >
> > I think that can be done using a simple forms class variable.
> >
> >
> > > a "per-page" basis. We also need some sort of caching
mechanism
> with
> > > a 'Life-Time' to regenerate/over-write the specified
JavaScript
> file
> > > on expiration of the specified life-time, over-riding all
other
> > > parameters even if they are valid. This way, any changes to
> content
> > > such as validation error messages, source updates or settings
> would
> > > be taken care of by itself, periodically.
> >
> > I do not see the need for cache file regeneration if the
> application can
> > inform all the script files that affect the form content.
> >
> > Making the generated Javascript file expire periodically only
makes
> > things more confusing and innefficient. That way the developer
may
> > change the application files and class still use outdated
> Javascript
> > file. Expiring the Javascript file periodically, also makes the
> > Javascript file be regenerated often when it may not be
necessary.
> >
> >
> > > That said, I guess you are good to go ahead and implement it
as
> a
> > > new feature.
> > >
> > > Thank you very much for your interest, time and efforts on
this
> > > feature. We appreciae it! It would really be a great addition
> and a
> > > useful feature for the class that would not only reduce the
HTML
> > > file size and page generation time but also improve the
> performance of the application as a whole.
> >
> > I will put it on my to do list for when I have more time to
> implement it.
> >
> >
> > --
> >
> > Regards,
> > Manuel Lemos
> >
> > Metastorage - Data object relational mapping layer generator
> > http://www.metastorage.net/
> >
> > PHP Classes - Free ready to use OOP components written in PHP
> > http://www.phpclasses.org/
> >
>

#890 From: "Shekar C. Reddy" <zendfw@...>
Date: Tue Mar 27, 2007 1:41 am
Subject: Re: Isolate JavaScript into disk-files
powerobject
Offline Offline
Send Email Send Email
 
Manuel,

Thanks much for considering this exciting feature implementation! I
hope you would address any derived extensions of the form_class
(descendants) by the developer while implementing it.

Could we discuss a little bit more on the caching mechanism? I did
not mean the developer would end up using outdated JavaScript files
by using caching. As you are aware, caching is automatic and
powerful which is used by several major frameworks and classes such
as Smarty.

During development, the developer sets the life-time to a very high
frequency such as every one hour. Any life-time greater than 0 would
mean to validate file-existence, compare file-time with life-time
for stale files and re/generate file if expired/missing. The
developer can also blow off the JavaScript files anytime to
regenerate them before their expiry or use configuration logic to
reset the life-time to refresh the files. Typically, its much easier
to manipulate configuration/files on dev environment.

Whereas on production, life-time is usually set to 0 which means
cache files never expire. The class would only validate for the
existence of the JavaScript file and would always generate if it is
missing but would never validate the file-times. When we copy
stabilized code from development into production or update the forms
class, all we need to do is blow off the related JavaScript files or
run a script to do it so they get generated on next page-load by
default. The overhead is too low with this approach. Even if we set
the life-time to 24 hours (just in case), they get generated only
once in a day.

class form_class
{
    function form_class( $javaScriptFile, $lifeTime = 0 );
}

    $form = new Form_Class( $javaScriptFile, $lifeTime );


Do you think it is ideal to offer caching as an additional feature -
when you are on it?

Further, since this is a major change, you may like to increment the
major version of the form_class.





--- In forms-dev@yahoogroups.com, Manuel Lemos <mlemos@...> wrote:
>
> Hello,
>
> on 03/22/2007 04:52 PM Shekar C. Reddy said the following:
> > Manuel,
> >
> > It would be great if the forms class can manage the process of
> > caching the JavaScript files. You quoted several issues and
offered
> > self-explanatory solutions to all of those except this one:
> >
> > "A different problem may occur to people using safe mode. In
that
> > case it may not be possible to creata the Javascript files due
to
> > safe mode permission restrictions. In that case should the forms
> > class Output function fail altogether and do not generate any
forms,
> > or silently generate the Javascript as part of the forms output
as
> > it is done today?"
> >
> > Yes, in case of file-write errors, the class may silently
generate
> > the JavaScript as part of the forms output as it is done today.
This
> > would be a 'generic' course of action to take.
>
> Yes, it sees the best solution. The class also will issue an error
that
> will be trapped by the debug callback function.
>
>
> > As for the 3rd-party plugins, we may have to offer some hints on
how
> > to resolve/update the information in the documentation or cover
it
> > in the video tutorials.
>
> I think it is better to fail the form output generation altogether
with
> an explicit error message if any plug-ins do not implement a
function
> that informs its files dependencies, when Javascript file
generation is
> requested.
>
>
> > We need to be able to specify the JavaScript file to be used on
>
> I think that can be done using a simple forms class variable.
>
>
> > a "per-page" basis. We also need some sort of caching mechanism
with
> > a 'Life-Time' to regenerate/over-write the specified JavaScript
file
> > on expiration of the specified life-time, over-riding all other
> > parameters even if they are valid. This way, any changes to
content
> > such as validation error messages, source updates or settings
would
> > be taken care of by itself, periodically.
>
> I do not see the need for cache file regeneration if the
application can
> inform all the script files that affect the form content.
>
> Making the generated Javascript file expire periodically only makes
> things more confusing and innefficient. That way the developer may
> change the application files and class still use outdated
Javascript
> file. Expiring the Javascript file periodically, also makes the
> Javascript file be regenerated often when it may not be necessary.
>
>
> > That said, I guess you are good to go ahead and implement it as
a
> > new feature.
> >
> > Thank you very much for your interest, time and efforts on this
> > feature. We appreciae it! It would really be a great addition
and a
> > useful feature for the class that would not only reduce the HTML
> > file size and page generation time but also improve the
performance of the application as a whole.
>
> I will put it on my to do list for when I have more time to
implement it.
>
>
> --
>
> Regards,
> Manuel Lemos
>
> Metastorage - Data object relational mapping layer generator
> http://www.metastorage.net/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>

#889 From: Manuel Lemos <mlemos@...>
Date: Mon Mar 26, 2007 10:24 pm
Subject: Re: form_custom_class::GenerateInputID()
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 03/25/2007 11:25 PM Shekar C. Reddy said the following:
> Manuel,
>
> How can I change the name format of the input from: 'p_name_suffix' to
> just: 'name_suffix' without touching the form class core or form_date
> core? I just want to eliminate the prefix altogether. I use PHP 5 but
> could not figure out a way to do this without storing the prefix in
> the class var and giving access to it before invoking GenerateInputID
> (). Or is it something terribly simple that I'm missing?

I already answered this here:

http://www.phpclasses.org/discuss/package/1/thread/66/

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#888 From: Manuel Lemos <mlemos@...>
Date: Mon Mar 26, 2007 10:23 pm
Subject: Re: Form_Date_Class usage
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 03/23/2007 07:18 PM Shekar C. Reddy said the following:
> Manuel,
>
> I'm trying to use the form_date_class for the first time along with
> Smarty but facing some issues. I get invalid
> input 'p_date_year', 'p_date_month' etc errors and the input would
> not render in the page except for the ' / / ' separators. I've also
> tried adding the code from test_date_input.php to the
> test_smarty_form.php as under but the page comes out blank:
>
>  require("form_date.php");
>  $day_seconds=60*60*24;
>  $start_date=strftime("%Y-%m-%d",time()+1*$day_seconds);
>  $end_date=strftime("%Y-%m-%d",time()+7*$day_seconds);
>  $form->AddInput(array(
> 	 "TYPE"=>"custom",
> 	 "ID"=>"date",
> 	 "LABEL"=>"<u>D</u>ate",
> 	 "ACCESSKEY"=>"D",
> 	 "CustomClass"=>"form_date_class",
> 	 "VALUE"=>strftime("%Y-%m-%d"),
> 	 "Format"=>"{day}/{month}/{year}",
> 	 "Months"=>array(
> 		 "01"=>"January",
> 		 "02"=>"February",
> 		 "03"=>"March",
> 		 "04"=>"April",
> 		 "05"=>"May",
> 		 "06"=>"June",
> 		 "07"=>"July",
> 		 "08"=>"August",
> 		 "09"=>"September",
> 		 "10"=>"October",
> 		 "11"=>"November",
> 		 "12"=>"December"
> 	 ),
> 	 "Optional"=>1,
> 	 "ValidationStartDate"=>$start_date,
> 	 "ValidationStartDateErrorMessage"=>"It was specified
> a schedule date before the start date.",
> 	 "ValidationEndDate"=>$end_date,
> 	 "ValidationEndDateErrorMessage"=>"It was specified a
> schedule date after the end date.",
>  ));
>
>
> FORM.TPL
> --------
> <tr>
> <th align="right">{label for="date"}:</th>
> <td>{input name="date"}</td>
> <td>{$mark}</td>
> {/if}
> </tr>
>
>
> I've also tried using inputs names such as p_date_year,
> p_date_month, etc. but in vain :(

I have already answered to this here:

http://www.phpclasses.org/discuss/package/1/thread/63/#246


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

#887 From: Manuel Lemos <mlemos@...>
Date: Mon Mar 26, 2007 10:21 pm
Subject: Re: Re: Separate JavaScript into disk-files
mallemos
Offline Offline
Send Email Send Email
 
Hello,

on 03/22/2007 04:52 PM Shekar C. Reddy said the following:
> Manuel,
>
> It would be great if the forms class can manage the process of
> caching the JavaScript files. You quoted several issues and offered
> self-explanatory solutions to all of those except this one:
>
> "A different problem may occur to people using safe mode. In that
> case it may not be possible to creata the Javascript files due to
> safe mode permission restrictions. In that case should the forms
> class Output function fail altogether and do not generate any forms,
> or silently generate the Javascript as part of the forms output as
> it is done today?"
>
> Yes, in case of file-write errors, the class may silently generate
> the JavaScript as part of the forms output as it is done today. This
> would be a 'generic' course of action to take.

Yes, it sees the best solution. The class also will issue an error that
will be trapped by the debug callback function.


> As for the 3rd-party plugins, we may have to offer some hints on how
> to resolve/update the information in the documentation or cover it
> in the video tutorials.

I think it is better to fail the form output generation altogether with
an explicit error message if any plug-ins do not implement a function
that informs its files dependencies, when Javascript file generation is
requested.


> We need to be able to specify the JavaScript file to be used on

I think that can be done using a simple forms class variable.


> a "per-page" basis. We also need some sort of caching mechanism with
> a 'Life-Time' to regenerate/over-write the specified JavaScript file
> on expiration of the specified life-time, over-riding all other
> parameters even if they are valid. This way, any changes to content
> such as validation error messages, source updates or settings would
> be taken care of by itself, periodically.

I do not see the need for cache file regeneration if the application can
inform all the script files that affect the form content.

Making the generated Javascript file expire periodically only makes
things more confusing and innefficient. That way the developer may
change the application files and class still use outdated Javascript
file. Expiring the Javascript file periodically, also makes the
Javascript file be regenerated often when it may not be necessary.


> That said, I guess you are good to go ahead and implement it as a
> new feature.
>
> Thank you very much for your interest, time and efforts on this
> feature. We appreciae it! It would really be a great addition and a
> useful feature for the class that would not only reduce the HTML
> file size and page generation time but also the performance of the
> application as a whole.

I will put it on my to do list for when I have more time to implement it.


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

Messages 887 - 916 of 945   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help