redirect_user action

chrissy6930 02 Jun, 2011
hi all,

I would like to use action redirecting the user to a specific url displaying a system message:
$mainframe->redirect(JRoute::_( $url ), $message );

the redirect_user action only allows for entering a uri, while in the help section its being said:

To set parameters in the Redirect URL, use the Configure Redirect action before this action and leave the URL here empty.


only where is the 'Configure Redirect action' mentioned ?

currently I've solved the matter by using a custom element with:
global $mainframe;
$url = 'index.php?option=com_chronoforms&Itemid='. JRequest::getInt('Itemid');
$message =  JText::_('Entry successfully saved');
$mainframe->redirect(JRoute::_( $url ), $message );


I also tried editing the above action (see attached zip) but something is not quite right about it as the edit icon wouldn't work any longer

could somebody please either help me finding the configure redirect action or how to fix the modified redirect_user action ?

J!1.5.23, CF 4 RC1.9
GreyHead 02 Jun, 2011
Hi chrissy6930 ,

Ah, it looks as though Max has chosen to remove that action (it was one of mine); there is a ReDirect URL action in the CURL group though that will probably do what you need. I'll dig out my action later and republish it in the 'advanced' actions list*.

Bob

* The advanced actions are more flexible, but in consequence use a more complicated syntax.
Max_admin 03 Jun, 2011
Hi Bob,

I didn't omit any actions, we still have the 2 redirect actions in the latest RC🙂

Did we have any others ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 11 Jun, 2011
Hi Max,

My apologies; I was wrong, the action was exactly what I sent to you.

The problem is that I never added the help tab to say that you could use both the curly syntax - for form values and a plain string for fixed values. For example:
amount={amount}
merchant_id=999999


Bob

Here is the revised content of redirect_url.ctp including the Help tab
<div class="dragable" id="cfaction_redirect_url">ReDirect URL</div>
<!--start_element_code-->
<div class="element_code" id="cfaction_redirect_url_element">
	<label class="action_label" style="display: block; float:none!important;">ReDirect URL</label>
	<input type="hidden" name="chronoaction[{n}][action_redirect_url_{n}_target_url]" 
    	id="action_redirect_url_{n}_target_url" value="<?php echo htmlspecialchars($action_params['target_url']); ?>" />
	<textarea name="chronoaction[{n}][action_redirect_url_{n}_content1]" 
    	id="action_redirect_url_{n}_content1" style="display:none"><?php echo $action_params['content1']; ?></textarea>
	<input type="hidden" id="chronoaction_id_{n}" name="chronoaction_id[{n}]" value="{n}" />
	<input type="hidden" name="chronoaction[{n}][type]" value="redirect_url" />
</div>
<!--end_element_code-->
<div class="element_config" id="cfaction_redirect_url_element_config">
<?php 
echo $PluginTabsHelper->Header(
	array(
		'general' => 'General', 
		'help' => 'Help'
	),
	'email_config_{n}'
); 

echo $PluginTabsHelper->tabStart('general');
echo $HtmlHelper->input('action_redirect_url_{n}_target_url_config', 
	array(
		'type' => 'text', 
		'label' => "Target URL", 
		'class' => 'big_input', 
		'smalldesc' => "The target URL without the query string."
));
echo $HtmlHelper->input('action_redirect_url_{n}_content1_config', 
	array(
		'type' => 'textarea', 
		'label' => 'Params/Fields map', 
		'rows' => 15, 
		'cols' => 50, 
		'smalldesc' => 'Multi line format of the Redirect field names; use {} curly brackets for form results: <br />e.g: 	
			param_name_1={form_field_name}<br />param_name_2=some_value')); 
echo $PluginTabsHelper->tabEnd(); 
echo $PluginTabsHelper->tabStart('help'); 
?>

<div>
    <div>This is a ReDirect URL Action for ChronoForms v4 on Joomla! 1.5 & 1.6. 
    It helps you to build a URL to redirect the user using information submitted from the form or
    constant values. Note that you also need the Redirect User action to complete the redirection.</div>
    <h4>The General tab</h4>
    <ul>
        <li>Enter the URL that you want to send the data to in the Target URL box. This must either be a valid URL 
        (complete with the http:// or https:// prefix) or a local relative URL. 
        If it is a local path then the site domain will be added.</li>
        <li>The Params/Fields map is the main configuration box. Enter each data item that you want to send in 
        this box using one line for each item. Each item takes the form of <tt>parameter=some_value</tt>. 
        You can use values from the form results by using the 'curly bracket' syntax {input_name}. 
        Note: to set an empty parameter use the value NULL; lines with no value will be ignored. </li>
        <li>Here's an example of a set of entries:<br />
        <tt>banana=name<br />lettuce=email<br />apple={name}<br />beetroot={email}</tt></li>
	</ul>
</div>
<?php
echo $PluginTabsHelper->tabEnd(); 
?>
</div>
This topic is locked and no more replies can be posted.