Re: [fw-general] Zend_Form select element always multi?

2008-03-06 Thread mrolli


Jeffrey Sambells-2 wrote:
> 
> The problem however is that for some reason it renders as a multi  
> select (with multiple="multiple"):
> 

Same problem here:

example1
$location_id = new Zend_Form_Element_Select('location_id');
$location_id->setLabel('ticket_locations')
->setRequired(true)
->addMultiOption('', null);

example2
$location_id = new Zend_Form_Element_Multiselect('location_id');
$location_id->setLabel('ticket_locations')
->setRequired(true)
->addMultiOption('', null);

Both render as 
whereas the former schould render as 
without the multiple attribute.

This is a new bug I think because this once worked like a charm but since
about a week (without changing my code) the HEAD seems broken.

Regard Michael
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-select-element-always-multi--tp15889624s16154p15890936.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Form select element always multi?

2008-03-06 Thread Jeffrey Sambells

I seem to be having a problem rendering a select box. I have this:

$form->addElement( 'select', 'select', array(
'label' => 'select',
'value' => 'value',
'multiOptions' => array(
'First', 'Second', 'third'
)
) );

The problem however is that for some reason it renders as a multi  
select (with multiple="multiple"):



select


	class="formSelect">

First
Second
third



Tracing through the code somewhere the name becomes select[] wiht a  
bracket [] when it shouldn't since it's a dropdown. Am I doing  
something wrong? I would like to to render as a dropdown list, not a  
multi select box.


- Jeffrey



Re: [fw-general] Zend_Filter_Input 'presence'=>'required'

2008-03-06 Thread thurting

Hi Brian,

You can change the relative message by setting it as an option of your
Zend_Filter_Input instance.  This can be done during instantiation or
through the setOptions() method.  You can not set different messages for
different filters/validators - only one message format per instance.  You
may want to use Zend_Validate_NotEmpty if you need more flexibility.  There
is sample code in the docs, but I will post it here to save you the trouble.


 "A non-empty value is required for field '%field%'"
);

$input = new Zend_Filter_Input($filters, $validators, $data, $options);

// alternative method:

$input = new Zend_Filter_Input($filters, $validators, $data);
$input->setOptions($options);

-- 
View this message in context: 
http://www.nabble.com/Zend_Filter_Input-%27presence%27%3D%3E%27required%27-tp15865637s16154p15885531.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Cache and Page caching

2008-03-06 Thread Steven Brown
Hi Simon,

You could possibly tag it and use that tag to remove the cache after it has
been saved, or you could create your own page caching with an option for
whether or not to save it. The basic Zend_Cache usage relies on you to do
the saving.

Cheers,
Steven

-Original Message-
From: Simon Mundy [mailto:[EMAIL PROTECTED] 
Sent: Friday, 7 March 2008 8:31 AM
To: Zend Framework
Subject: [fw-general] Zend_Cache and Page caching

Hi there - I have a quick Q about caching pages using the Zend_Cache  
'Page' frontend.

Is there any way of telling Zend_Cache not to store the page after the  
hit has been tested?

I.e. what I'd like to be able to do is to allow page caching as per  
normal for 99% of my pages, but in some controller/actions have the  
ability to cancel the page 'save' through the cache instance so the  
page is never cached? I realise I can perform a regex in the caching  
options but that's effectively a static rule. I'd like to be able to  
more closely control this based on user state and so forth.

Look forward to any help/hints

Cheerio!

--

Simon Mundy | Director | PEPTOLAB

""" " "" "" "" "" """ " "" " " " "  "" "" "

202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
4124
http://www.peptolab.com





Re: [fw-general] Zend_Db_Table: Problem with Relatationships

2008-03-06 Thread Jan Pieper

Yeah, this works fine :-)

-- Jan



Jan Pieper wrote:

$article->findDependentRowset('Author');

But the result is an Exception :(

Zend_Db_Table_Exception: No reference from table Author to table Article



In you example, a foreign key in Article references a primary key in Author.

So Author is the "parent", Article is the "dependent".  You are querying the
reverse relationship, which does not exist in this example.

Use this:

  $article->findParentRow('Author');

Regards,
Bill Karwin




Re: [fw-general] Zend_Filter_Input and messages

2008-03-06 Thread Paul Fitzpatrick


I know its bad discussion etiquette, but does anyone have a possible  
solution to my problem below?  I have tried it with 1.5 RC 1 and still 
have the same issue.


fugazied wrote:
I am having some issues with the custom messaging and Zend Input Filter. 
Probably something obvious I am missing, but a search couldn't help me find

a solution.  Some Code:

// 
$validators = array(
'email' => array('EmailAddress', 'presence'=>'required',
,'allowEmpty'=>false ),
'month' => array('Digits', 'presence'=>'required', ,'allowEmpty'=>false,
array('Between', 1, 10) )
);


$options = array(
'missingMessage' => "Field '%field%' is required",
'notEmptyMessage' => "A non-empty value is required for field '%field%'"

);
 
$input = new Zend_Filter_Input(null, $validators);

$input->setOptions($options);
$input->setData($_POST);

if ($input->hasInvalid() || $input->hasMissing()) {
  $invalidFields = $input->getInvalid();
  Zend_Debug::dump($invalidFields);

/*
Produces - 
array(2) {

  ["email"] => array(1) {
["emailAddressInvalid"] => string(71) "'' is not a valid email address
in the basic format [EMAIL PROTECTED]"
  }
  ["month"] => array(2) {
["stringEmpty"] => string(21) "'' is an empty string"
["notBetween"] => string(43) "'' is not between '1' and '10',
inclusively"
  }
}
*/
}
// 

I was under the impression that my custom messages would replace the " '' is
an empty string ".
And to avoid the other error messages appearing, display empty ' ' field
values I need to chain the validators correct?

Thanks!


  




[fw-general] Zend_Cache and Page caching

2008-03-06 Thread Simon Mundy
Hi there - I have a quick Q about caching pages using the Zend_Cache  
'Page' frontend.


Is there any way of telling Zend_Cache not to store the page after the  
hit has been tested?


I.e. what I'd like to be able to do is to allow page caching as per  
normal for 99% of my pages, but in some controller/actions have the  
ability to cancel the page 'save' through the cache instance so the  
page is never cached? I realise I can perform a regex in the caching  
options but that's effectively a static rule. I'd like to be able to  
more closely control this based on user state and so forth.


Look forward to any help/hints

Cheerio!

--

Simon Mundy | Director | PEPTOLAB

""" " "" "" "" "" """ " "" " " " "  "" "" "

202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654  
4124

http://www.peptolab.com



Re: [fw-general] Zend_Db_Table: Problem with Relatationships

2008-03-06 Thread Bill Karwin


Jan Pieper wrote:
> 
> $article->findDependentRowset('Author');
> 
> But the result is an Exception :(
> 
> Zend_Db_Table_Exception: No reference from table Author to table Article
> 

In you example, a foreign key in Article references a primary key in Author.

So Author is the "parent", Article is the "dependent".  You are querying the
reverse relationship, which does not exist in this example.

Use this:

  $article->findParentRow('Author');

Regards,
Bill Karwin
-- 
View this message in context: 
http://www.nabble.com/Zend_Db_Table%3A-Problem-with-Relatationships-tp15882889s16154p15883753.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Db_Table: Problem with Relatationships

2008-03-06 Thread Jan Pieper

Hi guys,

i am trying to create references between my model classes based on
Zend_Db_Table_Abstract but it does not function. I donĀ“t know why and so 
I hope

someone of you guys can help me :-)

_I have 2 simple tables:_
flabben.article (id, [...], author_id)
flabben.author (id, [...])

*File:* _~/application/models/Article.php

_* *array*(
'columns' => 'author_id',
'refTableClass' => 'Author',
'refColumns' => 'id'
)
);
}


*?>*

*File:* _~/application/models/Author.php_
*

*Now I am trying to get the depending author for the actual selected article
(in my application, this code is inside IndexController::indexAction).

*find(1);
$article = $articles->current();

$article->findDependentRowset('Author');

*?>

*But the result is an Exception :(

*Zend_Db_Table_Exception*

[0] No reference from table Author to table Article

#0 
C:\Server\httpd\htdocs\Flabben\library\Zend\Db\Table\Row\Abstract.php(680): 
Zend_Db_Table_Abstract->getReference('Article', NULL)
#1 
C:\Server\httpd\htdocs\Flabben\library\Zend\Db\Table\Row\Abstract.php(723): 
Zend_Db_Table_Row_Abstract->_prepareReference(Object(Author), 
Object(Article), NULL)
#2 C:\Server\httpd\htdocs\Flabben\library\Flabben\Db\Table\Row.php(48): 
Zend_Db_Table_Row_Abstract->findDependentRowset(Object(Author), NULL)
#3 
C:\Server\httpd\htdocs\Flabben\application\views\scripts\index\index.phtml(23): 
Flabben_Db_Table_Row->findDependentRowset('Author')
#4 C:\Server\httpd\htdocs\Flabben\library\Zend\View.php(46): 
include('C:\Server\httpd...')
#5 C:\Server\httpd\htdocs\Flabben\library\Zend\View\Abstract.php(765): 
Zend_View->_run('C:\Server\httpd...')
#6 
C:\Server\httpd\htdocs\Flabben\library\Zend\Controller\Action\Helper\ViewRenderer.php(860): 
Zend_View_Abstract->render('index/index.pht...')
#7 
C:\Server\httpd\htdocs\Flabben\library\Zend\Controller\Action\Helper\ViewRenderer.php(881): 
Zend_Controller_Action_Helper_ViewRenderer->renderScript('index/index.pht...', 
NULL)
#8 
C:\Server\httpd\htdocs\Flabben\library\Zend\Controller\Action\Helper\ViewRenderer.php(929): 
Zend_Controller_Action_Helper_ViewRenderer->render()
#9 
C:\Server\httpd\htdocs\Flabben\library\Zend\Controller\Action\HelperBroker.php(161): 
Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#10 
C:\Server\httpd\htdocs\Flabben\library\Zend\Controller\Action.php(506): 
Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#11 
C:\Server\httpd\htdocs\Flabben\library\Zend\Controller\Dispatcher\Standard.php(242): 
Zend_Controller_Action->dispatch('indexAction')
#12 
C:\Server\httpd\htdocs\Flabben\library\Zend\Controller\Front.php(927): 
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), 
Object(Zend_Controller_Response_Http))
#13 C:\Server\httpd\htdocs\Flabben\www\index.php(22): 
Zend_Controller_Front->dispatch()

#14 {main}

-- Jan


Re: [fw-general] Zend_Locale Quality

2008-03-06 Thread Arthur M. Kang
It seems like the "default" for the locale aware classes is to simply 
use the first one set, regardless of the quality value.  Is that 
correct?  If so, what would be the best method for me to "rearrange" 
them to have the locale I want as default to be first without messing 
with the ZF code?


Arthur


Thomas Weidner wrote:

Arthur...

The manual is you friend:
http://framework.zend.com/manual/en/zend.locale.html#zend.locale.introduction 


See "using a default locale".

As you can read the "default" locale is the last line of defense when 
no way of detection has worked.

If you want to use a fixed locale you have to set it with setLocale().

Also to mention: There is no way to set a higher level than 1.0 
because 100% is the maximum. For this reason you would never know 
which locale is used if there are multiple at the same level... when 
this happens the user states that he doesn't mind which is used. But 
you do, so you must not use the autodetection but a manual set one.


Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

- Original Message - From: "Arthur M. Kang" 
<[EMAIL PROTECTED]>

To: 
Sent: Thursday, March 06, 2008 2:14 AM
Subject: [fw-general] Zend_Locale Quality



Is there any way to set the default locale where the quality will be
greater than the browser?  If I set a default locale, it never gets used
by the locale aware classes as it gets a quality rating of 0.1 and the
browser locales get 1.0.

Arthur



Re: [fw-general] Critical Error with Zend_Session

2008-03-06 Thread Darby Felton
Maybe try PHP ext/session configuration (i.e., session.gc_probability, 
session.gc_divisor, session.gc_maxlifetime)? You can set these options 
with Zend_Session::setOptions(); please see the following documentation 
for more information:


http://framework.zend.com/manual/en/zend.session.global_session_management.html#zend.session.global_session_management.configuration_options

(Sorry for the long URL)

Maybe you are on a FAT filesystem?

Best regards,
Darby

WooKasZ wrote:

So what should I do to make it work ? I have to clean this session directory.
My GB function:

function garbageCollection( $dir, $lifetime ) {
if ( $resDirectory = opendir( $dir ) ) {
while ( ( $strFile = readdir( $resDirectory ) ) !== false ) {

if ( is_file( $dir . $strFile ) ) {
if ( time() > filemtime( $dir . $strFile ) + $lifetime 
) {
unlink( $dir . $strFile );
}
}
}

closedir( $resDirectory );
}


Matthew Weier O'Phinney-3 wrote:

-- Steven Brown <[EMAIL PROTECTED]> wrote
(on Thursday, 06 March 2008, 07:53 AM +1000):

Matthew is it possible Zend_Session needs an option like Zend_Cache to
store session files in layered directories so there are not too many
files in a single directory at once?


Zend_Session does not do session storage, and instead leaves it to PHP's
session mechanisms. All it does is provide an interface to the $_SESSION
global as well as to the various session_*() configuration functions.

The error below is due to the user's own session handler, which
Zend_Session has no knowledge of -- as is is, even if they used
session_start() without Zend_Session, they'd get a PHP warning.


-Original Message-
From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 5 March 2008 11:49 PM

To: fw-general@lists.zend.com
Subject: Re: [fw-general] Critical Error with Zend_Session

-- WooKasZ <[EMAIL PROTECTED]> wrote
(on Wednesday, 05 March 2008, 05:35 AM -0800):

Hello ! I have a problem with Zend_Session class.
Sometimes when I am refreshing page or clicking on a link this fatal

error

occurs:
Code:

Fatal error: Uncaught exception 'Zend_Session_Exception' 
with message 'Zend_Session::start() - session_start()

 [ function.session-start function.session-start ]:

ps_files_cleanup_dir:
opendir(_sessions/) failed: Result too large (34)' 
in H:\www\wz\Zend\Session.php:379 Stack trace: 
#0 H:\www\wz\Zend\Session\Namespace.php(116): Zend_Session::start(true) 
#1 H:\www\wz\init\session.php(16):
Zend_Session_Namespace->__construct() 
#2 H:\www\wz\init\init.php(10): require_once('H:\www\wz\init\...') 
#3 H:\www\wz\index.php(21): require_once('H:\www\wz\init\...')

#4 {main} thrown in H:\www\wz\Zend\Session.php on line 379

Here is the code in my app:

require_once('Zend/Session.php');

garbageCollection( $config['session']['savepath'],
$config['session']['lifetime'] );

ini_set( 'session.cache_expire', 
			$config['session']['cache_exp']);  
ini_set( 'session.gc_maxlifetime', 
			$config['session']['lifetime'] );


session_save_path( $config['session']['savepath'] );

$defSessNamespace  = new Zend_Session_Namespace( );

garbageCollector is cleaning folder with sessions.
I use it (and init_set) couse I didin't found it in docs.

Based on the message exception from the exception thrown, it looks like
your GC routine is having trouble getting a list of sessions to remove
-- that perhaps there are too many for the OS to handle at once.

--
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/



--
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/






Re: [fw-general] Critical Error with Zend_Session

2008-03-06 Thread WooKasZ

So what should I do to make it work ? I have to clean this session directory.
My GB function:

function garbageCollection( $dir, $lifetime ) {
if ( $resDirectory = opendir( $dir ) ) {
while ( ( $strFile = readdir( $resDirectory ) ) !== false ) {

if ( is_file( $dir . $strFile ) ) {
if ( time() > filemtime( $dir . $strFile ) + $lifetime 
) {
unlink( $dir . $strFile );
}
}
}

closedir( $resDirectory );
}


Matthew Weier O'Phinney-3 wrote:
> 
> -- Steven Brown <[EMAIL PROTECTED]> wrote
> (on Thursday, 06 March 2008, 07:53 AM +1000):
>> Matthew is it possible Zend_Session needs an option like Zend_Cache to
>> store session files in layered directories so there are not too many
>> files in a single directory at once?
> 
> 
> Zend_Session does not do session storage, and instead leaves it to PHP's
> session mechanisms. All it does is provide an interface to the $_SESSION
> global as well as to the various session_*() configuration functions.
> 
> The error below is due to the user's own session handler, which
> Zend_Session has no knowledge of -- as is is, even if they used
> session_start() without Zend_Session, they'd get a PHP warning.
> 
>> -Original Message-
>> From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
>> Sent: Wednesday, 5 March 2008 11:49 PM
>> To: fw-general@lists.zend.com
>> Subject: Re: [fw-general] Critical Error with Zend_Session
>> 
>> -- WooKasZ <[EMAIL PROTECTED]> wrote
>> (on Wednesday, 05 March 2008, 05:35 AM -0800):
>> > 
>> > Hello ! I have a problem with Zend_Session class.
>> > Sometimes when I am refreshing page or clicking on a link this fatal
>> error
>> > occurs:
>> > Code:
>> > 
>> > Fatal error: Uncaught exception 'Zend_Session_Exception' 
>> > with message 'Zend_Session::start() - session_start()
>> >  [ function.session-start function.session-start ]:
>> ps_files_cleanup_dir:
>> > opendir(_sessions/) failed: Result too large (34)' 
>> > in H:\www\wz\Zend\Session.php:379 Stack trace: 
>> > #0 H:\www\wz\Zend\Session\Namespace.php(116): Zend_Session::start(true) 
>> > #1 H:\www\wz\init\session.php(16):
>> Zend_Session_Namespace->__construct() 
>> > #2 H:\www\wz\init\init.php(10): require_once('H:\www\wz\init\...') 
>> > #3 H:\www\wz\index.php(21): require_once('H:\www\wz\init\...')
>> > #4 {main} thrown in H:\www\wz\Zend\Session.php on line 379
>> > 
>> > Here is the code in my app:
>> > 
>> > require_once('Zend/Session.php');
>> > 
>> > garbageCollection( $config['session']['savepath'],
>> > $config['session']['lifetime'] );
>> > 
>> > ini_set( 'session.cache_expire', 
>> >$config['session']['cache_exp']);  
>> > ini_set( 'session.gc_maxlifetime', 
>> >$config['session']['lifetime'] );
>> > 
>> > session_save_path( $config['session']['savepath'] );
>> > 
>> > $defSessNamespace  = new Zend_Session_Namespace( );
>> > 
>> > garbageCollector is cleaning folder with sessions.
>> > I use it (and init_set) couse I didin't found it in docs.
>> 
>> Based on the message exception from the exception thrown, it looks like
>> your GC routine is having trouble getting a list of sessions to remove
>> -- that perhaps there are too many for the OS to handle at once.
>> 
>> -- 
>> Matthew Weier O'Phinney
>> PHP Developer| [EMAIL PROTECTED]
>> Zend - The PHP Company   | http://www.zend.com/
>> 
>> 
> 
> -- 
> Matthew Weier O'Phinney
> PHP Developer| [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Critical-Error-with-Zend_Session-tp15850221s16154p15879536.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Locale Quality

2008-03-06 Thread Arthur M. Kang

Thomas,

Thanks for the reply.  I did read the manual and what you stated was 
pretty much what I concluded.


Shouldn't there be a way to manually OVERRIDE the autodetection and SET 
THE LOCALE that all "locale aware classes" should use?  Otherwise, you 
have to create the locale object and use it to create the locale aware 
objects (no convenience).  Frankly, I don't even know which classes ARE 
locale aware.  I think it is much more intuitive for setDefault to be 
the *highest *quality, not the lowest.  Don't you think?  Lowest should 
be something like 'setFailsafe' or 'setFallback'.


Let me give you a use case.  You create a site where users register and 
can select their language of choice.  As long as the user is sending 
HTTP_ACCEPT_LANGUAGE with the language of choice, defaults should work 
fine and there is no need to pass locale objects.  Right?  Then, one of 
your users goes to a different country and logs in to your site via an 
internet cafe.  That cafe has a different set for HTTP_ACCEPT_LANGUAGE 
and they do not allow you to change their settings.  The user cannot see 
their selected language UNLESS the site was created using a locale 
object and all locale aware classes where created explicitly with a 
locale.  This eliminates all "convenience" of the locale aware classes.  
The developer needs to continually monitor which classes are "locale 
aware" and instantiate them with the correct locale.


*It would truly be convenient *if you could set a locale either via 
setDefault or another method, and then all locale aware classes would 
*just *use that locale, overriding everything else..


Maybe I'm missing the boat on this...

If you don't see the need for this, maybe you could give me some insight 
on how I could achieve this.  Looks like all of the locale aware classes 
specifically call Zend_Locale so does it doesn't make any sense to 
subclass.  How else could I do this?  I don't want to modify the ZF code.


Thanks for the help.

Arthur


Thomas Weidner wrote:

Arthur...

The manual is you friend:
http://framework.zend.com/manual/en/zend.locale.html#zend.locale.introduction 


See "using a default locale".

As you can read the "default" locale is the last line of defense when 
no way of detection has worked.

If you want to use a fixed locale you have to set it with setLocale().

Also to mention: There is no way to set a higher level than 1.0 
because 100% is the maximum. For this reason you would never know 
which locale is used if there are multiple at the same level... when 
this happens the user states that he doesn't mind which is used. But 
you do, so you must not use the autodetection but a manual set one.


Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

- Original Message - From: "Arthur M. Kang" 
<[EMAIL PROTECTED]>

To: 
Sent: Thursday, March 06, 2008 2:14 AM
Subject: [fw-general] Zend_Locale Quality



Is there any way to set the default locale where the quality will be
greater than the browser?  If I set a default locale, it never gets used
by the locale aware classes as it gets a quality rating of 0.1 and the
browser locales get 1.0.

Arthur



[fw-general] Zend_Layout with nested layout?

2008-03-06 Thread Jeffrey Sambells

Hi All,

I'm just playing with Zend_Layout and have a quick question. What I'd  
like to do is have a three part view. I'd like my designer to design a  
wrapper "template" that consists of the markup surrounding the output  
of action views. This is exactly what Zend_Layout does so perfect! but  
if possible I'd like the designer templates to exclude the doctype,  
head and  and  tag stuff and stick strictly to what comes  
after .  That way designers don't need to worry about the non- 
design stuff.


The question is how to wrap the head and whatnot around the layout?

I thought of extending the ViewRendered render() method to accomplish  
this, which would work, however I wasn't sure if there was a native  
way to have a Zend_Layout within a Zend_Layout so that I could have:


doc.phtml:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>




headTitle() ?>
headScript() ?>
headStyle() ?>


   layout()->content ?>



which includes the following designer layout.phtml in "content":



layout()->nav ?>

layout()->content ?>


which includes the action.phtml template in "content".


Thanks.

- Jeffrey


Re: [fw-general] Zend_Filter_Input 'presence'=>'required'

2008-03-06 Thread brian3f

I'm still having trouble with this.  I can set error messages for individual
validators that I use, like the documentation describes:

 array(
'digits',
'messages' => 'A month must consist only of digits'
)
);

However, I'm unable to do this for the metacommands  'precence'.   When I
change the code above to check for presence and try to supply an error
message: 

 array(
'digits',
'presence' => 'required',
'messages' => array('A month must consist only of digits',
array('missingMessage' => "A value is required 
for field 'Month'"))
)
);

I get the error message: Fatal error: Uncaught exception
'Zend_Validate_Exception' with message 'No message template exists for key
'missingMessage'' in library\Zend\Validate\Abstract.php:129

I am able to set and error message globally for the 'presence' metacommand
using:

 "A value is required for field '%field%'"
);

$input = new Zend_Filter_Input($filters, $validators, $data, $options);


But this doesn't allow me to put a user presentable field name into the
message.

Brian



SiCo007 wrote:
> 
> Brian you need to take a look at the message system that accompanies the
> filter_input
> 
> http://framework.zend.com/manual/en/zend.filter.input.html#zend.filter.input.metacommands.messages
> 
> Then it's just a case of specifying the correct message for the correct
> action. Sometimes you will need to look in the validator to check what
> messages it sets up.
> 
> Simon
> 
> 
> brian3f wrote:
>> 
>> I'm using Zend_Filter_Input to validate form data.  I'm trying to use the
>> 'presence' => 'required', metacommand.  My problem is, the error message
>> generated by this command includes the actual field name that is being
>> checked.  my field name is something 'first_name' but I want to display
>> 'First Name'.  Here is some pseodo code representing what I'm doing.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Filter_Input-%27presence%27%3D%3E%27required%27-tp15865637s16154p15877121.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Filter_Input 'presence'=>'required'

2008-03-06 Thread SiCo007

Brian you need to take a look at the message system that accompanies the
filter_input

http://framework.zend.com/manual/en/zend.filter.input.html#zend.filter.input.metacommands.messages

Then it's just a case of specifying the correct message for the correct
action. Sometimes you will need to look in the validator to check what
messages it sets up.

Simon


brian3f wrote:
> 
> I'm using Zend_Filter_Input to validate form data.  I'm trying to use the
> 'presence' => 'required', metacommand.  My problem is, the error message
> generated by this command includes the actual field name that is being
> checked.  my field name is something 'first_name' but I want to display
> 'First Name'.  Here is some pseodo code representing what I'm doing.


-
Simon Corless

http://www.ajb007.co.uk/
-- 
View this message in context: 
http://www.nabble.com/Zend_Filter_Input-%27presence%27%3D%3E%27required%27-tp15865637s16154p15873112.html
Sent from the Zend Framework mailing list archive at Nabble.com.