Hi,
I've a problem with the Hash element when used in a form submitted via AJAX. The form contents are validated on the server side, and useful error messages are returned JSON-encoded (ex. missing or incomplete fields). The problem is that, when using Zend_Form_Element_Hash, the stored hash is valid for only 1 form submission (1 hop), so if I change the code of Zend_Form_Element_Hash to increase the hop to 2, I'm only able to do 1 correction before the forms generates missingToken errors. I am aware that the funcionality provided by the hash is precisely the limiting of operations for a given form, but is there any way to disable the hop count, and use ony a timeout value? A quick solution for my problem would be to deattach the element validation from the form processing itself and into a separated method, so the hash validation can be performed after every other field has been validated,
eg using something like:

    if ($form->isValid($_POST)) {
        if ($form->validHash()) {
                // do something here
        }
    }

Is there an easy way to do this?
I'm using ZF 1.10.7

Regards,
    João Pinheiro

Reply via email to