AAAAPK jž?\q\ét· · http_request.phpnu W+A„¶ '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();
}
}
?>PK jž?\ Mdüü ü http_request.ctpnu W+A„¶
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'); ?>
- Sometimes we need to submit our form to 2 different URLs, this was hard to do, the only way to do this was to use the CURL library, however, this action should allow this to be done now.
- For example, set your form's action URL to PayPal, Moneybookers or SugarCRM..etc and use this HTTP Request to communicate with one of your form events, or vice versa.
- If you want to disable the form submission, add this code to the "Form tag attachment" field: onSubmit="return false;"
tabEnd(); ?>
PK jž?\žÙÜ
index.htmlnu W+A„¶
PK jž?\Ç#PÅ Å cfaction_http_request.phpnu W+A„¶ params);
$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);
}
}
?>PK jž?\®)ÕÐ .htaccessnu W+A„¶