[pmwiki-users] No HTML source for hidden fields

Hans design5 at softflow.co.uk
Sun Oct 17 07:16:42 CDT 2010


Sunday, October 17, 2010, 8:43:44 AM, jamesdevain at mail.com wrote:

> Hello, all. I'm wondering if there is a way to prevent hidden inputs
> (as in (:input hidden ...:)) from rendering as html in the page source,
> but still be processed on form submission.

> The problem is this: I create a form like...

> (:fox form1 ptvtarget=SomePage:)
> (:input hidden answer Yes:)
> (:input submit post Submit:)
> (:foxend form1:)

> ... and the user can just copy the HTML source from the webpage,
> create a new webpage on their desktop, edit it and change "Yes" to
> "No", and then submit the new form.

> Would it be possible to create a recipe for this? I'm not asking
> anyone to do that, I'm just wondering if it's possible. I tried messing
> around with scripts/forms.php just to test some things, but didn't get
> any positive results.

you could use a fox filter function, and have your value supplied
with this. The filter function can get ptrocessed after form
submission, but before any other Fox process.
See http://www.pmwiki.org/wiki/Cookbook/Fox#filters

remove the (:input hidden answer Yes:)
and add to the fox form something like:

(:input hidden foxfilter mycustomfilter:)

then put in config.php before fox.php is included
something like:

$FoxFilterFunctions['mycustomfilter'] = 'MyCustomFilter';
function MyCustomFilter($pagename, $fx) {
   //my custom processes here:
   $fx['answer'] = 'Yes';
   return $fx;
}


cheers,
  ~Hans




More information about the pmwiki-users mailing list