Re: [fw-general] Setting form element id

2010-02-16 Thread mathieu.suen

Hector Virgen wrote:
The ID is based on the name of the element. If your element it named 
"lock" the ID will be "lock", or if using subforms, will be 
"{subform}-lock".


If you mess with the ID's, Zend_Form won't know how to handle the 
posted data because browsers post data based on the IDs of the inputs.


No, that's base on the name not the IDS



Why do you need to change the ID?


Javascript, css stuff.



--
Hector


On Tue, Feb 16, 2010 at 12:31 AM, mathieu.suen 
mailto:mathieu.s...@easyflirt.com>> wrote:


Саша Стаменковић wrote:

Chage

$mySubForm->getElement('lock')->setAttribs('id', 'lock' .
$server->getUniqueId());

to

$mySubForm->getElement('lock')->setAttrib('id', 'lock' .
$server->getUniqueId());


Actually I mean setAttrib. The issue still remain.
The more I dig in the code the more I get made at it.

Adding design patter is a good things but in that situation it is
harmful.


Regards,
Saša Stamenković



On Tue, Feb 16, 2010 at 9:06 AM, mathieu.suen
mailto:mathieu.s...@easyflirt.com>
>> wrote:

   Hi,

   How do you setup the id of form element?
   I try this:

   $mySubForm->getElement('lock')->id = 'lock' .
$server->getUniqueId();

   and also:

   $mySubForm->getElement('lock')->setAttribs('id', 'lock' .
   $server->getUniqueId());

   But non of the above work.

   It always yield something like : subForm-myuniqueid-load

   Then I decide to look at the code and found out that is
completely
   odd and really not well design IMHO.

   So if you have any idea thanks

   --Mathieu Suen




 



-- Mathieu Suen

   





--Mathieu Suen





[fw-general] Re: 1.10.0rc1 breaks resource autoloader

2010-02-16 Thread gerardroche

I agree, if DbTable is not being changed to dbtables then the mapper path
should be Mapper:

models/dbtables
models/mappers

models/DbTable
models/Mapper

models/DbTables
models/Mappers

I prefer the last one.
-- 
View this message in context: 
http://n4.nabble.com/1-10-0rc1-breaks-resource-autoloader-tp1115382p1558178.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] the reference guide is really getting on my nerves

2010-02-16 Thread Jason Austin
I, too, am experiencing similar issues on ff3.6 on osx.  It seems to
have only happened since the commenting system was put into place, if
that helps.  It wasn't just a blank page for me either.  Once I did
get something to load, it was incredibly slow.

- Jason

On Mon, Feb 15, 2010 at 6:55 PM, Mark Wright  wrote:
> I emptied my cache so it no longer happens with every page, but it
> still happens about a quarter of the time. I am using ff 3.6 on osx
> 10.6.2. There is nothing special about my browser settings.
>
>
>
> Mark
>
> On Mon, Feb 15, 2010 at 9:15 AM, Matthew Weier O'Phinney
>  wrote:
>> -- Mark Wright  wrote
>> (on Friday, 12 February 2010, 02:39 PM -0700):
>>> Every time I go to a page in the reference guide that I have not
>>> already been to I just get a blank page. Sometimes it happens even if
>>> I have already been to that page, like when hitting the back button. I
>>> know that a reload will fix it (sometimes it takes two or three
>>> reloads), but why on earth do have have to do that with every single
>>> page?
>>
>> Are you still experiencing this? If so, what browser and operating
>> system are you using, so we can try and reproduce the issue?
>>
>> I have personally tried FF 3.5 and Chrome 4 on Linux with no problems;
>> I'd try Windows, but my current network setup prevents my WinXP vm from
>> reaching the outside world.
>>
>> --
>> Matthew Weier O'Phinney
>> Project Lead            | matt...@zend.com
>> Zend Framework          | http://framework.zend.com/
>> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>>
>
>
>
> --
> Have fun or die trying - but try not to actually die.
>



-- 
Jason Austin
Senior Solutions Implementation Engineer
NCSU - OIT - Outreach Technology
jason_aus...@ncsu.edu


[fw-general] Re: the reference guide is really getting on my nerves

2010-02-16 Thread monk.e.boy

install 'live http headers' and see what the site is responding with. I
expect it is a network error at your end, if it were the site we'd all be
seeing the same problems.

monk.e.boy
-- 
View this message in context: 
http://n4.nabble.com/the-reference-guide-is-really-getting-on-my-nerves-tp1490447p1557248.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Re: Setting form element id

2010-02-16 Thread takeshin

Try extending Zend_Form to do it automatically for you.


class My_Form extends Zend_Form() 
{

...

 private function _getUniqueId() {
$names = $this->getId();
foreach ($this->getElements() as $element) {
$names .= $element->getName();
}

return md5($names);
}

/**
 * Unique identifier for this form
 * @return string
 */
public function getIdentifier()
{
if (null !== $this->_identifier) {

return $this->_identifier;
}

$id = $this->getId();

if (empty($id)) {
$id = $this->getName();
}

if (empty($id)) {
$id = $this->_getUniqueId();
}

$id = 'form_' . $id;

$this->_identifier = $id;

return $id;
}

/**
 * Add to the form hidden field with unique identifier
 */
private function _addIdentifier()
{
//if (!$this->_identifierAdded) {
$name = $this->getIdentifier();
$element = new Zend_Form_Element_Hidden($name);
$this->addElement($element);
   // $this->_identifierAdded;
//}
}

public function render($view = null)
{
$this->_addIdentifier();

return parent::render($view);
}

}



-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Setting-form-element-id-tp1557052p1557210.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Re: some questions about dojo's autocomplete

2010-02-16 Thread ramzesua

Is there way, how to do this?
-- 
View this message in context: 
http://n4.nabble.com/some-questions-about-dojo-s-autocomplete-tp1556226p1557136.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Easy way to page generation times

2010-02-16 Thread Ross Little

Hi Guys

I'm developing a web app using the Zend Framework and want to be able to
measure my page load times so that I can tweak my database queries and
caching to maximum effect.

Essentially, all I'm looking for is a string at the bottom of every page
saying: page generated in 

Cheers guys

Ross
-- 
View this message in context: 
http://n4.nabble.com/Easy-way-to-page-generation-times-tp1556938p1556938.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Re: Easy way to get page generation times

2010-02-16 Thread takeshin

Try ZFDebug:
http://code.google.com/p/zfdebug/

-- 
regards
takeshin
-- 
View this message in context: 
http://n4.nabble.com/Easy-way-to-get-page-generation-times-tp1556938p1557042.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] PDO or Mysqli?

2010-02-16 Thread Ross Little

Hi Guys

I'm relatively new to ZF, but it seems that just about every tutorial out
there uses the Mysqli adapter but everywhere else, I read about how much
more secure and efficient the PDO adapter is.  Is this true?

In order to take advantage of PDO, do I only need to change my
resources.db.adapter in my application.ini file?  I tried this and I didn't
notice any difference. I mean, i don't imagine it'll make a discernable
difference on my development version of the code, but it didn't break
anything.  

Any thoughts?

Ross
-- 
View this message in context: 
http://n4.nabble.com/PDO-or-Mysqli-tp1556941p1556941.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Zend_Test and assertQuery() failing in 1.10.1

2010-02-16 Thread Hector Virgen
Is anyone else experiencing problems with
Zend_Test_PHPUnit_ControllerTestCase#assertQuery() in 1.10.1?

In 1.10.0, my unit tests were passing successfully, but after upgrading to
1.10.1, all of my assertQuery() tests result in the same error:

1) UsersControllerTest::testNotLoggedInOnLoginPageDoesNotCauseRedirection
DOMDocument::loadHTML(): Unexpected end tag : a in Entity, line: 30

/Users/hvirgen/Web/library/ZendFramework-1.10.1/library/Zend/Dom/Query.php:186
/Users/hvirgen/Web/library/ZendFramework-1.10.1/library/Zend/Dom/Query.php:160
/Users/hvirgen/Web/library/ZendFramework-1.10.1/library/Zend/Test/PHPUnit/Constraint/DomQuery.php:157
/Users/hvirgen/Web/library/ZendFramework-1.10.1/library/Zend/Test/PHPUnit/ControllerTestCase.php:290
/Users/hvirgen/Web/projects/datadirector3/tests/application/controllers/UsersControllerTest.php:17

I have verified that the response body is valid XHTML, so I'm not sure why
it's saying there's a broken anchor.

--
Hector


Re: [fw-general] validator Db_NoRecordExists -- support for multifield unique indices?

2010-02-16 Thread David Mintz
On Thu, Feb 11, 2010 at 5:03 PM, Саша Стаменковић wrote:

> Can we see the source?
>
> Regards,
> Saša Stamenković
>
>
>
Sure...

The next thing however that I plan to do is likewise add support for
multiple columns in the 'exclude' option.

toArray();
}
if (array_key_exists('fields',$options)) {
$this->_fields =  $options['fields'];
// to prevent parent from throwing missing option exception:
$options['field'] = $this->_fields;
}
parent::__construct($options);
}


function isValid($value,$context=null) {


$this->_setValue($value);
/** FROM Zend_Validate_Db_Abstract: ///
 * Check for an adapter being defined. if not, fetch the default
adapter.
 */

if ($this->_adapter === null) {
$this->_adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
if (null === $this->_adapter) {
throw new Zend_Validate_Exception('No database adapter
present');
}
}
if (! $this->_fields) { // plural !
$result = $this->_query($value);
if ($result) {
$this->_error(self::ERROR_RECORD_FOUND);
return false;
} else {
return true;
}
}
/**
 * Build select object
 */

$select = new Zend_Db_Select($this->_adapter);


$select->from($this->_table, $this->_fields, $this->_schema);
// sole difference from parent implementation: add multiple WHERE
clauses
// note: we are assuming form field name == column name
foreach ($this->_fields as $field) {
$select->where("$field = ?",$context[$field]);
}

if ($this->_exclude !== null) {
if (is_array($this->_exclude)) {

$select->where($this->_adapter->quoteIdentifier($this->_exclude['field']).'
!= ?', $this->_exclude['value']);
} else {
$select->where($this->_exclude);
}
}
$select->limit(1);

$result = $this->_adapter->fetchRow($select, array(),
Zend_Db::FETCH_ASSOC);
if ($result) {
$this->_error(self::ERROR_RECORD_FOUND);
   return false;
} else {
return true;
}
}
}




-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/


Re: [fw-general] Setting form element id

2010-02-16 Thread Hector Virgen
The ID is based on the name of the element. If your element it named "lock"
the ID will be "lock", or if using subforms, will be "{subform}-lock".

If you mess with the ID's, Zend_Form won't know how to handle the posted
data because browsers post data based on the IDs of the inputs.

Why do you need to change the ID?

--
Hector


On Tue, Feb 16, 2010 at 12:31 AM, mathieu.suen
wrote:

> Саша Стаменковић wrote:
>
>> Chage
>>
>> $mySubForm->getElement('lock')->setAttribs('id', 'lock' .
>> $server->getUniqueId());
>>
>> to
>>
>> $mySubForm->getElement('lock')->setAttrib('id', 'lock' .
>> $server->getUniqueId());
>>
>
> Actually I mean setAttrib. The issue still remain.
> The more I dig in the code the more I get made at it.
>
> Adding design patter is a good things but in that situation it is harmful.
>
>
>> Regards,
>> Saša Stamenković
>>
>>
>>
>> On Tue, Feb 16, 2010 at 9:06 AM, mathieu.suen 
>> > mathieu.s...@easyflirt.com>> wrote:
>>
>>Hi,
>>
>>How do you setup the id of form element?
>>I try this:
>>
>>$mySubForm->getElement('lock')->id = 'lock' . $server->getUniqueId();
>>
>>and also:
>>
>>$mySubForm->getElement('lock')->setAttribs('id', 'lock' .
>>$server->getUniqueId());
>>
>>But non of the above work.
>>
>>It always yield something like : subForm-myuniqueid-load
>>
>>Then I decide to look at the code and found out that is completely
>>odd and really not well design IMHO.
>>
>>So if you have any idea thanks
>>
>>--Mathieu Suen
>>
>>
>>
>>
>>
>>
>>
> -- Mathieu Suen
>
>
>
>


Re: [fw-general] customizing validation message for checkbox

2010-02-16 Thread Mike Wright

SunWuKung wrote:

Hi,
I am trying to throw a custom validation message (SomeMessage) when a
checkbox is not ticked, but so far I had no luck.

This works for other elements, but not for the checkbox:

elements.data_protection.type = "checkbox"
elements.data_protection.options.label = "SomeLabel:"
elements.data_protection.options.required = true
elements.data_protection.options.uncheckedValue = null
elements.data_protection.validators.notempty.validator = "NotEmpty"
elements.data_protection.validators.notempty.options.messages.isEmpty =
"SomeMessage"


You're close.  Validators are options.  Here's how I do it:

elements.firstname.type = "text"
elements.firstname.options.validators.notempty.validator = "notEmpty"
elements.firstname.options.validators.notempty.options.messages.isEmpty 
= "The first name is required."


Hope that helps,
Mike Wright


Re: [fw-general] Re: problem with zend framework installation on XAMPP

2010-02-16 Thread Mark Steudel
Can you send us the error?

Also sometimes I will copy the path
"d:\xampp\php\ZendFramework\library" and put it either in the
Start->Run (windows)
%ls PATH (mac terminal)

Just to make sure I didn't fat finger the path.

On Mon, Feb 15, 2010 at 10:05 AM, Farazch  wrote:
>
> Yes i have added the drive letter and make php.ini file as
>
> include_path = ".;\xampp\php\pear\;D:\xampp\php\ZendFramework\library"
>
> And then i have restarted the XAMPP,but its giving same error .:-((
> --
> View this message in context: 
> http://n4.nabble.com/problem-with-zend-framework-installation-on-XAMPP-tp1556212p1556421.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>



-- 

-
Mark Steudel
P: 206.375.7244
msteu...@gmail.com

. : Work : .
http://www.mindfulinteractive.com

. : Play : .
http://www.steudel.org/blog


[fw-general] Warning: array_fill(): Number of elements must be positive in Zend_Paginator_Adapter_Null

2010-02-16 Thread umpirsky

This code:

$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null(0));

gives:

Warning: array_fill(): Number of elements must be positive in
Zend/Paginator/Adapter/Null.php on line 68 Warning: Passed variable is not
an array or object, using empty array instead.

also, please note that   public function __construct($count = 0) is default
value for item count in Zend_Paginator_Adapter_Null.

So, it fails if item count is 0. Should I post a bug or I'm missing
something?

PHP Version 5.2.12

Regards,
Sasa Stamenkovic.
-- 
View this message in context: 
http://n4.nabble.com/Warning-array-fill-Number-of-elements-must-be-positive-in-Zend-Paginator-Adapter-Null-tp1557439p1557439.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] customizing validation message for checkbox

2010-02-16 Thread SunWuKung

Hi,
I am trying to throw a custom validation message (SomeMessage) when a
checkbox is not ticked, but so far I had no luck.

This works for other elements, but not for the checkbox:

elements.data_protection.type = "checkbox"
elements.data_protection.options.label = "SomeLabel:"
elements.data_protection.options.required = true
elements.data_protection.options.uncheckedValue = null
elements.data_protection.validators.notempty.validator = "NotEmpty"
elements.data_protection.validators.notempty.options.messages.isEmpty =
"SomeMessage"

Could somebody tell me how to do this?
Many thanks.
Balazs
-- 
View this message in context: 
http://n4.nabble.com/customizing-validation-message-for-checkbox-tp1557432p1557432.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Re: Captcha decorator

2010-02-16 Thread Andrei Iarus
It is obviously a bug. I have reported it to the ZF issues.

--- On Sun, 2/14/10, dmitrybelyakov  wrote:


From: dmitrybelyakov 
Subject: [fw-general] Re: Captcha decorator
To: fw-general@lists.zend.com
Date: Sunday, February 14, 2010, 3:45 PM



Maybe some one will post a 'real' solution to this.

I'm gonna bookmark this topic because it seems to me that
Zend_Form_Element_Captcha does not allow you to use multiple HtmlTag
decorators on the element. It just uses the last one you set and ignores all
the rest.

Maybe you end up writing your own custom decorator to insert arbitrary
text/html and use it along wth HtmlTag. That may be a handy tool for other
strange cases.

Here's a link to Mattew explaining how to do 
http://devzone.zend.com/article/3450-Decorators-with-Zend_Form Decorators
with Zend_Form 


Hope this is of any help,
Dmitry.
-- 
View this message in context: 
http://n4.nabble.com/Captcha-decorator-tp1554698p1555110.html
Sent from the Zend Framework mailing list archive at Nabble.com.



  

[fw-general] Setting form element id

2010-02-16 Thread mathieu.suen

Hi,

How do you setup the id of form element?
I try this:

$mySubForm->getElement('lock')->id = 'lock' . $server->getUniqueId();

and also:

$mySubForm->getElement('lock')->setAttribs('id', 'lock' . 
$server->getUniqueId());


But non of the above work.

It always yield something like : subForm-myuniqueid-load

Then I decide to look at the code and found out that is completely odd 
and really not well design IMHO.


So if you have any idea thanks

--Mathieu Suen








Re: [fw-general] Setting form element id

2010-02-16 Thread mathieu.suen

Саша Стаменковић wrote:

Chage

$mySubForm->getElement('lock')->setAttribs('id', 'lock' . 
$server->getUniqueId());


to

$mySubForm->getElement('lock')->setAttrib('id', 'lock' . 
$server->getUniqueId());


Actually I mean setAttrib. The issue still remain.
The more I dig in the code the more I get made at it.

Adding design patter is a good things but in that situation it is harmful.



Regards,
Saša Stamenković


On Tue, Feb 16, 2010 at 9:06 AM, mathieu.suen 
mailto:mathieu.s...@easyflirt.com>> wrote:


Hi,

How do you setup the id of form element?
I try this:

$mySubForm->getElement('lock')->id = 'lock' . $server->getUniqueId();

and also:

$mySubForm->getElement('lock')->setAttribs('id', 'lock' .
$server->getUniqueId());

But non of the above work.

It always yield something like : subForm-myuniqueid-load

Then I decide to look at the code and found out that is completely
odd and really not well design IMHO.

So if you have any idea thanks

--Mathieu Suen




   





-- Mathieu Suen





Re: [fw-general] Setting form element id

2010-02-16 Thread Саша Стаменковић
Chage

$mySubForm->getElement('lock')->setAttribs('id', 'lock' .
$server->getUniqueId());

to

$mySubForm->getElement('lock')->setAttrib('id', 'lock' .
$server->getUniqueId());

Regards,
Saša Stamenković


On Tue, Feb 16, 2010 at 9:06 AM, mathieu.suen wrote:

> Hi,
>
> How do you setup the id of form element?
> I try this:
>
> $mySubForm->getElement('lock')->id = 'lock' . $server->getUniqueId();
>
> and also:
>
> $mySubForm->getElement('lock')->setAttribs('id', 'lock' .
> $server->getUniqueId());
>
> But non of the above work.
>
> It always yield something like : subForm-myuniqueid-load
>
> Then I decide to look at the code and found out that is completely odd and
> really not well design IMHO.
>
> So if you have any idea thanks
>
> --Mathieu Suen
>
>
>
>
>
>
>