quickForm - adding custom attributes to process functio

Do you have questions regarding Pecl or Pear? ask here!

Moderators: macek, egami, gesf

Riku Tuominen
New php-forum User
New php-forum User
Posts: 17
Joined: Wed May 04, 2005 11:37 pm

quickForm - adding custom attributes to process functio

Postby Riku Tuominen » Sun Aug 13, 2006 1:18 am

My problem is to add attributes to the process_data function.
I also need more attributes than just the form attribute.

I CHANGED THE EXAMPLE CODE, MAYBE THIS CAN BE SOLVED.

This seem to work
$form->process('process_data', false);

Now I like to also pass form attribute but cant get it to work
$form->process(array(&$form, 'process_data'), false);

// seems like is_callable does not accept the callback function?


function process_data($values) {
// proces data code here
}


// ***** THIS IS A READY MADE PEAR LIBRARY METHOD
/**
* Performs the form data processing
*
* @param mixed $callback Callback, either function name or array(&$object, 'method')
* @param bool $mergeFiles Whether uploaded files should be processed too
* @since 1.0
* @access public
* @throws HTML_QuickForm_Error
*/
// definition of the function is displayed at: http://pear.php.net/manual/en/package.html.html-quickform.html-quickform.process.php
function process($callback, $mergeFiles = true)
{
if (!is_callable($callback)) {
return PEAR::raiseError(null, QUICKFORM_INVALID_PROCESS, null, E_USER_WARNING, "Callback function does not exist in QuickForm::process()", 'HTML_QuickForm_Error', true);
}

$values = ($mergeFiles === true) ? HTML_QuickForm::arrayMerge($this->_submitValues, $this->_submitFiles) : $this->_submitValues;
echo "callback <BR>";

return call_user_func($callback, $values);
} // end func process[/url]
Last edited by Riku Tuominen on Tue Aug 22, 2006 3:27 am, edited 5 times in total.

Riku Tuominen
New php-forum User
New php-forum User
Posts: 17
Joined: Wed May 04, 2005 11:37 pm

Postby Riku Tuominen » Wed Aug 16, 2006 6:52 am

I still hope to get some help on this.
This is crusial for me to get working for my project!

Please someone.

Riku Tuominen
New php-forum User
New php-forum User
Posts: 17
Joined: Wed May 04, 2005 11:37 pm

Postby Riku Tuominen » Mon Aug 21, 2006 1:10 pm

I chaged the code example in hope my problem is more understandable!

Riku Tuominen
New php-forum User
New php-forum User
Posts: 17
Joined: Wed May 04, 2005 11:37 pm

Postby Riku Tuominen » Wed Aug 23, 2006 11:08 am

Well I solved the problem.

I missunderstod the purpose of the function.
I tried to send attributes to the function.
Insted I should have sent only on object which has all the needed attributes and process_data function.

Now I have it working. :)


Return to “PEAR and PECL”

Who is online

Users browsing this forum: No registered users and 0 guests

cron