2008年12月27日星期六

RE: [fw-mvc] Another Zend_Form checkboxes bug ?

Hello John,

I think this behavior is expected in checkboxes due the nature of the element (what is defined as empty o required if you can change checked or unchecked value?). however there is a workaround to do this validation without affect your  code outside of your form definition as follows:

 

Class SomeForm extends Zend_Form

{

 

public function __construct($options = null)

{

                Your code here

                …

}

 

//override isValid method

public function isValid($data)

{

                $valid = true;

 

                //validate your checkbox according your code below,  if checkbox is checked, value is set to 1

                If ($this->contract->getValue() != 1)

                {

                               $this->addError(‘you must agree our conditions!’);

                               $valid = false;

                }

               

                return parent::isValid($data) && $valid;

}

}

 

I hope this works for your case.

Best Regards,

Jaime Garcia.

 

De: John Antony Riga [mailto:ja.riga@yahoo.com]
Enviado el: Sábado, 27 de Diciembre de 2008 07:53 a.m.
Para: Zend Framework MVC
Asunto: [fw-mvc] Another Zend_Form checkboxes bug ?

 

Hello everyone !

I'm having a little problem with checkboxes, I'm using this element :
  
    // ACCEPT CONDITIONS
         $this->addElement(
                    'CheckBox',
                    'contract',
                    array(
                        'label'        => 'I accept the terms of service',
                        'style'            =>'margin-left:100px;',
                        'required'   => true,
                        'checkedValue' => '1',
                        'validators'     =>  array(array('NotEmpty', true)),
                    )
                );
       
I need my users to check the checkbox before the can submit the form, but actually it's not the case. Checking the checkbox is not required to validate the form despite what I wrote (require => true) and the form subimts

Is this a bug ? I saw there was a lot of bugs in the checkbox form elements so this might be a new one. Or is this me doing somehting wrong ?
JA.

 

[fw-mvc] Another Zend_Form checkboxes bug ?

Hello everyone !

I'm having a little problem with checkboxes, I'm using this element :
  
    // ACCEPT CONDITIONS
         $this->addElement(
                    'CheckBox',
                    'contract',
                    array(
                        'label'        => 'I accept the terms of service',
                        'style'            =>'margin-left:100px;',
                        'required'   => true,
                        'checkedValue' => '1',
                        'validators'     =>  array(array('NotEmpty', true)),
                    )
                );
       
I need my users to check the checkbox before the can submit the form, but actually it's not the case. Checking the checkbox is not required to validate the form despite what I wrote (require => true) and the form subimts

Is this a bug ? I saw there was a lot of bugs in the checkbox form elements so this might be a new one. Or is this me doing somehting wrong ?
JA.

2008年12月26日星期五

[fw-webservices] Zend_XmlRpc_Server - Calling parameters do not match

Server Code:

class RpcController extends Zend_Controller_Action {

    public function indexAction() {
        $this->_helper->viewRenderer->setNoRender();
        $server = new Zend_XmlRpc_Server();
        $server->setEncoding('utf-8');
        $server->setClass('MyLib_Rpc');
        $this->getResponse()->clearBody();
        $this->getResponse()->setBody($server->handle());
    }
}


class MyLib_RPC {

    /**
     * @param string $key
     * @return string
     */
    public function login($key) {
         $sid = md5($key);
         retunr $sid;
    }
}


print_r($server->getSystem()->methodSignature('login'));

Question:

This code work on different servers. On some servers it's ok and return

Array
(
[0] => Array
(
[returnType] => void
[parameters] => Array
(
[0] => string
)

)
)

on other its return struct.
Where is problem ? What php extensions need for this code ?





--
Andrey Korolyov | WEB Developer

e | akorolyov@gmail.com

[fw-mvc] How to manipulate complete response?

How to push the complete response of an http request into a function and
show its result instead?

I thought I have to extend Zend_Controller_Response_Http::__toString()
but it is never executed in my application. I already searched about an
hour to find the place where to put my function call but I can't find
it. I am using Zend_Layout (MVC).

Any clue where to put my function call?

-- Jan

2008年12月25日星期四

Re: [fw-core] Fatal error in live environment

Ok. I have kind of identified the problem.
I am using the PluginLoader class file include cache, if I disable it the site seems to work.
Also the same happens with file caching.
 
Could the error be beacuse of the directory permission issue, because the filenames seem fine.
 
-R

 
On 12/26/08, Tobias Gies <tobiasgies@googlemail.com> wrote:
Hey Raavi,

first thing that comes to mind when switching from Windows to a *NIX
environment is of course file naming. Are you sure that your module
directories are all named lowercase, and that your controller
filenames are in CamelCase like this: Module_IndexController.php?

Best regards,
Tobias

2008/12/25 Raavi Raaj <raaviraaj77@gmail.com>:
> Hi,
>
> My ZF application worked perfectly in the developemt environment (windows
> xp + xampp), but on the live environment (FreeBSD) it gives me this error...
>
> Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No
> default module defined for this application' in
> /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php:380
> Stack trace:
> #0 /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php(203):
> Zend_Controller_Dispatcher_Standard->getControllerClass(Object(Zend_Controller_Request_Http))
> #1 /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php(237):
> Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Http))
> #2 /usr/www/users/mapn/library/Zend/Controller/Front.php(934):
> Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
> Object(Zend_Controller_Response_Http))
> #3 /usr/www/users/mapn/public/index.php(17):
> Zend_Controller_Front->dispatch()
> #4 {main} thrown in
> /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php on line
> 380
>
> Any clues where I should be investigating...
> I really have no idea where to start looking, all guidance is appreciated.
>
> Wising you all merry christmas and a happy new year!
>
> -R

Re: [fw-core] Fatal error in live environment

Hey Raavi,

first thing that comes to mind when switching from Windows to a *NIX
environment is of course file naming. Are you sure that your module
directories are all named lowercase, and that your controller
filenames are in CamelCase like this: Module_IndexController.php?

Best regards,
Tobias

2008/12/25 Raavi Raaj <raaviraaj77@gmail.com>:
> Hi,
>
> My ZF application worked perfectly in the developemt environment (windows
> xp + xampp), but on the live environment (FreeBSD) it gives me this error...
>
> Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No
> default module defined for this application' in
> /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php:380
> Stack trace:
> #0 /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php(203):
> Zend_Controller_Dispatcher_Standard->getControllerClass(Object(Zend_Controller_Request_Http))
> #1 /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php(237):
> Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Http))
> #2 /usr/www/users/mapn/library/Zend/Controller/Front.php(934):
> Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
> Object(Zend_Controller_Response_Http))
> #3 /usr/www/users/mapn/public/index.php(17):
> Zend_Controller_Front->dispatch()
> #4 {main} thrown in
> /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php on line
> 380
>
> Any clues where I should be investigating...
> I really have no idea where to start looking, all guidance is appreciated.
>
> Wising you all merry christmas and a happy new year!
>
> -R

[fw-core] Fatal error in live environment

Hi,
 
My ZF application worked perfectly in the developemt environment (windows xp + xampp), but on the live environment (FreeBSD) it gives me this error...
 
Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 'No default module defined for this application' in /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php:380
Stack trace:
#0 /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php(203): Zend_Controller_Dispatcher_Standard->getControllerClass(Object(Zend_Controller_Request_Http))
#1 /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php(237): Zend_Controller_Dispatcher_Standard->isDispatchable(Object(Zend_Controller_Request_Http))
#2 /usr/www/users/mapn/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#3 /usr/www/users/mapn/public/index.php(17): Zend_Controller_Front->dispatch()
#4 {main} thrown in /usr/www/users/mapn/library/Zend/Controller/Dispatcher/Standard.php on line 380
 
Any clues where I should be investigating...
I really have no idea where to start looking, all guidance is appreciated.
 
Wising you all merry christmas and a happy new year!
 
-R