Howdie Everybody,
I want to create a new Plugin for Chronoforms,
I started with taking a look at the exisitng extension for Paypal and i changed the show_conf function part and the names and description etc.
afterwards i was pretty happy when i saw my new extension. and i could also configure and save it for a form.
So far so good but now for testing i want to redirect after pressing the send butten of that form so i did following testing code:
File name is: cf_Verkkomaksut_Rest.php
and in the form this plugin is activated (green)
but i am not redirected after pressing the send button.
So could somebody help me understanding this ??
Greetings
Tobi
I want to create a new Plugin for Chronoforms,
I started with taking a look at the exisitng extension for Paypal and i changed the show_conf function part and the names and description etc.
afterwards i was pretty happy when i saw my new extension. and i could also configure and save it for a form.
So far so good but now for testing i want to redirect after pressing the send butten of that form so i did following testing code:
<?php
defined('_JEXEC') or die('Restricted access');
global $mainframe;
require_once( $mainframe->getPath( 'class', 'com_chronocontact' ) );
// the class name must be the same as the file name without the .php at the end
class cf_Verkkomaksut_Rest
{
//the next 3 fields must be defined for every plugin
var $result_TITLE = "cf_Verkkomaksut_Rest";
var $result_TOOLTIP = "";
var $plugin_name = "cf_Verkkomaksut_Rest"; // must be the same as the class name
var $event = "ONSUBMIT"; // must be defined and in Uppercase, should be ONSUBMIT or ONLOAD
// the next function must exist and will have the backend config code
function show_conf($row, $id, $form_id, $option){
global $mainframe;
jimport('joomla.html.pane');
$pane =& JPane::getInstance('tabs');
$paramsvalues = new JParameter($row->params);
?>
<form action="index2.php" method="post" name="adminForm" id="adminForm" class="adminForm">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="form_id" value="<?php echo $form_id; ?>" />
<input type="hidden" name="name" value="<?php echo $this->plugin_name; ?>" />
<input type="hidden" name="event" value="<?php echo $this->event; ?>" />
<input type="hidden" name="option" value="<?php echo $option; ?>" />
<input type="hidden" name="task" value="save_conf" />
</form>
<?php
}
// this function must exist and may not be changed unless you need to customize something
function save_conf( $option ) {
global $mainframe;
$database =& JFactory::getDBO();
$post = JRequest::get( 'post' , JREQUEST_ALLOWRAW );
$row =& JTable::getInstance('chronocontactplugins', 'Table');
if (!$row->bind( $post )) {
JError::raiseWarning(100, $row->getError());
$mainframe->redirect( "index2.php?option=$option" );
}
$params = JRequest::getVar( 'params', '', 'post', 'array' );
if (is_array( $params )) {
$txt = array();
foreach ( $params as $k=>$v) {
$txt[] = "$k=$v";
}
$row->params = implode( "\n", $txt );
}
if (!$row->store()) {
JError::raiseWarning(100, $row->getError());
$mainframe->redirect( "index2.php?option=$option" );
}
$mainframe->redirect( "index2.php?option=".$option, "Config Saved" );
}
/**
* The function that will be executed when the form is submitted
*
*/
function onsubmit( $option, $params, $row )
{
global $mainframe;
$MyForm =& CFChronoForm::getInstance();
$MyForm->formrow->redirecturl = 'http://www.test.de';
}
}
?>
File name is: cf_Verkkomaksut_Rest.php
and in the form this plugin is activated (green)
but i am not redirected after pressing the send button.
So could somebody help me understanding this ??
Greetings
Tobi