You are viewing the PKP Support Forum | PKP Home Wiki

Can I Access POSTED Form Variables?

OCS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, michael

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Can I Access POSTED Form Variables?

Postby BVBAccelerate » Wed Mar 16, 2011 9:24 am


I'm trying to develop a payment plugin. I was wondering if I there was any way I could access the POST variables that are passed through the payment form.

I know that this uses the MVC architecture and that the arguments are passed in the URL, but I was wondering if there were any default capabilities for me to access form variables that I don't want put into the URL.

Thanks in advance!

EDIT:: Also, I've set up my plugin with the appropriate files to create the tables and records for email templates, but I can't figure out how to install my plugin so it does this properly. I can upload the files directly and have the plugin work but the tables and data are not inserted into the database using the schema.xml, data.xml, and emailTemplates.xml files.

On our site I browse to Home > User > Conference Site Management > Plugin Management > Install A New Plugin and it just says it needs to be a compressed .tar.gz file. I did this in Linux and uploaded the file through this interface, and it said Version.xml not found in the plugin directory. I know it is in there, do I need to have any special structure in the .tar.gz file to get it to work?

All of the documentation I've read on this only tells me general guidelines for how to write a plugin, but does not provide information I need to bring it to completion so it can be shared.
Posts: 33
Joined: Mon Apr 19, 2010 2:01 pm

Re: Can I Access POSTED Form Variables?

Postby mcrider » Tue Mar 22, 2011 10:52 am

Hi BVBAccelerate,

Accessing form data is usually done through a form class--See for example SettingsForm.inc.php in plugins/generic/webFeed/. The form class is called from your handler (e.g. your main payment plugin class) and form values are read in after the readInputData() method of the form is called--You can then operate on that data in the execute() method of the form class. There are loads more examples of using form classes throughout the code.

As for installing plugins that have tables to install, take a look at this postthat describes the two ways you can install plugins.

Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Can I Access POSTED Form Variables?

Postby BVBAccelerate » Thu Sep 22, 2011 9:42 am

Hey, I know it's been a while but I finally looked into what you were talking about (it was at plugins/generic/announcementFeed for anyone else reading this post) and how they extended the form class for the specific needs of that plugin. I was able to get what I wanted without having to extend the class, I just imported the form class using 'import('form.Form');' and I was able to read all of the form data using the readUserVars() function. I just passed into that function an array with values being the names of the fields on the form that was posted.

Thanks for pointing me in the right direction!
Posts: 33
Joined: Mon Apr 19, 2010 2:01 pm

Return to OCS Development

Who is online

Users browsing this forum: No registered users and 0 guests