[pmwiki-users] PmForm - change summary and cancel button
DaveG
pmwiki at solidgone.com
Tue Mar 1 19:27:36 CST 2011
Check out BlogIt, which uses PmForms, that might help (or might be too
complex to easily grab info quickly).
On 3/1/2011 4:54 PM, Randy Brown wrote:
> I am successfully using a PmForm to change page text variables, but I have two problems that I've been unable to solve:
>
> 1) Upon save, I want the page's change summary updated too (either automatically, or with user-entered information from the form).
Setup some form of event handler. From BlogIt:
SDV($HandleActions['bi_be'], 'bi_HandleEdit'); SDV($HandleAuth['bi_be'],
'admin');
In your case that might be:
SDV($HandleActions['my_edit'], 'my_HandleEdit');
SDV($HandleAuth['my_edit'], 'edit');
in my_HandleEdit() something like (make sure you declare $ChangeSummary,
$_POST, etc, as global in your function):
if ($_POST['target']=='savedata' && @$_POST['save']{
$ChangeSummary = $_POST['ptv_MyPTV'];
}
> 2) I would also like a cancel button. (It seems whatever I do, my buttons save the data, regardless of their name or value.)
Search for 'cancel' in BlogIt for actual use. Basically:
if ($_POST['cancel'] && in_array($_REQUEST['target'],$bi_Forms))
This is checking for the Cancel button being clicked, and then checking
that the form being submitted is one being managed by PmForms.
Simplified for your case that might be:
if ($_POST['cancel'] && $_REQUEST['target']=='savedata')
Hope that gets you in a direction to move forward a step.
~ ~ Dave
More information about the pmwiki-users
mailing list