[Pieforms-commit] SF.net SVN: pieforms: [144] pieforms-php5/trunk/src/pieform.php
Status: Alpha
Brought to you by:
oracleshinoda
From: <ora...@us...> - 2006-12-25 23:45:27
|
Revision: 144 http://svn.sourceforge.net/pieforms/?rev=144&view=rev Author: oracleshinoda Date: 2006-12-25 15:45:25 -0800 (Mon, 25 Dec 2006) Log Message: ----------- Forms will now die if execution is continuing after the submit function is called, however this behaviour can be turned off if necessary (the transient login page in Mahara requires it to be off) Modified Paths: -------------- pieforms-php5/trunk/src/pieform.php Modified: pieforms-php5/trunk/src/pieform.php =================================================================== --- pieforms-php5/trunk/src/pieform.php 2006-12-24 06:29:24 UTC (rev 143) +++ pieforms-php5/trunk/src/pieform.php 2006-12-25 23:45:25 UTC (rev 144) @@ -255,6 +255,12 @@ // like cancel buttons 'iscancellable' => true, + // Whether Pieforms should die after calling a submit function. Generally + // this is a good idea, as it forces the user to reply to the form + // submission. However, there are occasions where you might want to let + // it continue, so this behaviour can be turned off + 'dieaftersubmit' => true, + // Whether to auto-focus either the first field (if the value is true, // or the named field (if the value is a string) when the form is // displayed. If this has any value other than false and the form has @@ -514,14 +520,20 @@ // finished processing the form. // @todo maybe it should do just that... call_user_func_array($function, array($this, $values)); - // This will only work if I can make the login_submit function stuff work in login_validate - //if ($this->ajaxpost) { - // $message = 'Your ' . $this->name . '_submit function should output some json and exit'; - //} - //else { - // $message = 'Your ' . $this->name . '_submit function should redirect when it is finished'; - //} - //throw new PieformException($message); + if ($this->data['dieaftersubmit']) { + // This will only work if I can make the login_submit function stuff work in login_validate + if ($this->data['jsform']) { + $message = 'Your ' . $this->name . '_submit function should use $form->json_reply to send a response'; + } + else { + $message = 'Your ' . $this->name . '_submit function should redirect or exit when it is done'; + } + throw new PieformException($message); + } + else { + // Successful submission, and the user doesn't care about replying, so... + return; + } } else if (!$submitted) { throw new PieformException('No function registered to handle form submission for form "' . $this->name . '"'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |