AAAAhttp_request.php000066600000002667151374564570010044 0ustar00 'redirect', 'title' => 'Redirect/Remote Submit'); var $details = array('title' => 'HTTP Request', 'tooltip' => 'Initiate an HTTP request call.'); function load($clear){ if($clear){ $action_params = array( 'enabled' => 0, 'http_request_url' => '', 'request_event' => 'submit', 'response_element_id' => '', 'event_element_id' => '', 'onrequest_fn' => '', 'onsuccess_fn' => '', 'onfailure_fn' => '', ); } return array('action_params' => $action_params); } function run($form, $actiondata){ ob_start(); ?> function(){ $('chronoform_form_name; ?>').removeClass('hasValidation'); request_caller_id; ?>(); } form_details->params); $form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess); $form->form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess); $form->form_details->params = $form_params->toString(); } } ?>http_request.ctp000066600000012774151374564570010043 0ustar00
HTTP Request
Header(array('settings' => 'Settings', 'advanced' => 'Advanced', 'help' => 'Help'), 'http_request_config_{n}'); ?> tabStart('settings'); ?> input('action_http_request_{n}_enabled_config', array('type' => 'select', 'label' => 'Enabel HTTP Request', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'Enable the form to initiate an HTTP request before its submitted, example, the form atcion may be set to PayPal but you want to run the submission routine before moving to PayPal.')); ?> input('action_http_request_{n}_http_request_url_config', array('type' => 'text', 'label' => "HTTP Request URL", 'class' => 'big_input', 'smalldesc' => "The url to which the HTTP request call will be made, usually the same form url but ends with &event=submit")); ?> input('action_http_request_{n}_request_event_config', array('type' => 'select', 'label' => 'Request Event', 'options' => array('submit' => "Form's onSubmit", 'click' => 'onClick', 'change' => 'onChange'), 'smalldesc' => 'The event at which the request will be triggered, this is a browser side event, please do not mix with server side forms events.')); ?> input('action_http_request_{n}_event_element_id_config', array('type' => 'text', 'label' => "Event Element ID", 'class' => 'medium_input', 'smalldesc' => "The id of the element which will have the event to be used, leave empty iof you select the onSubmit.")); ?> input('action_http_request_{n}_response_element_id_config', array('type' => 'text', 'label' => "Response Element ID", 'class' => 'medium_input', 'smalldesc' => "The id of the element which will be loaded with the response string when the request is completed with success.")); ?> tabEnd(); ?> tabStart('advanced'); ?> input('action_http_request_{n}_onrequest_fn_config', array('type' => 'text', 'label' => "On Request Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is sent, please add the 2 brackets at the end, e.g: myfn()")); ?> input('action_http_request_{n}_onsuccess_fn_config', array('type' => 'text', 'label' => "On Success Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request is completed successfully, please add the 2 brackets at the end, e.g: myfn()")); ?> input('action_http_request_{n}_onfailure_fn_config', array('type' => 'text', 'label' => "On Failure Function name", 'class' => 'medium_input', 'smalldesc' => "A JS function name to run when the request has failed, please add the 2 brackets at the end, e.g: myfn()")); ?> tabEnd(); ?> tabStart('help'); ?>

tabEnd(); ?>
index.html000066600000000035151374564570006564 0ustar00 cfaction_http_request.php000066600000004705151374564570011705 0ustar00params); $document = JFactory::getDocument(); //create the JS function ob_start(); ?> //id; ?> = function(){ var myForm = $('chronoform_form_name; ?>'); if(myForm.hasClass('hasValidation') == get('request_event', 'submit') == 'submit') ? "false" : "true"; ?>){ myForm.set('send', { url: 'get('http_request_url', ''); ?>', method: 'post', async: false, onRequest: function(){ get('onrequest_fn'))) > 0){ echo trim($params->get('onrequest_fn')).";"; } ?> }, onSuccess: function(responseText, responseXML){ get('response_element_id', ''))): ?> $('get('response_element_id', '')); ?>').set('html', responseText); get('onsuccess_fn'))) > 0){ echo trim($params->get('onsuccess_fn')).";"; } ?> }, onFailure: function(xhr){ get('onfailure_fn'))) > 0){ echo trim($params->get('onfailure_fn')).";"; } ?> } }); myForm.send('get('http_request_url', ''); ?>'); } } window.addEvent('domready', function() { get('request_event', 'submit') == 'submit'): ?> if($('chronoform_form_name; ?>').hasClass('hasValidation') == false){ $('chronoform_form_name; ?>').addEvent('submit', request_caller_id; ?>); } $('get('event_element_id', ''); ?>').addEvent('get('request_event', 'submit'); ?>', request_caller_id; ?>); }); //]]> addScriptDeclaration($script); } } ?>.htaccess000066600000000177151374564570006374 0ustar00 Order allow,deny Deny from all cfaction_http_request.ctp000066600000000204151374564570011672 0ustar00loadAction($form, $actiondata); ?>