Forums

switch action question

Ron 16 Feb, 2019
Hello

Can I use in switch action switching field like this ?
'AF'.'Afghanistan'=url/path/file/self.php
I have a special path for every country and making a switch for 'Select' and 'Unselect' would mean making over 500 events. Is there a shorter way to do it ? I have a php code for it which I am using in CFV5 but it does not seem to work in CFV6.
Thanks
Ron
healyhatman 16 Feb, 2019
Just fix your PHP code. I assume you have something like
$form->data["field"]
When in v6 it should be
$this->data("field")
Ron 17 Feb, 2019
Here is the complete code that works withCFV5.
<?php

$app = JFactory::getApplication();
$country = $app->input->getString( 'country', '', 'post' );


switch ( $country ) {

case 'AF' . 'Afghanistan':
$url = 'intl_deal1';
break;
case 'AL' . 'Albania':
$url = 'intl_deal2';
break;

default:
$url = 'intl_deal_aprox';
}

$url = JURI::base() . 'index.php?option=com_chronoforms6&chronoform=' . $url;
?>
I tried it in custom code CSV6 and also in php block it does not work.

Thanks for the help
Ron
healyhatman 17 Feb, 2019
Get country with the syntax I gave you
Ron 17 Feb, 2019
Thanks for remembering.but this is altogether a different code. I have solved or given up on earlier issues. In this case I just need to redirect user to a different url as per country selected.

Ron
This topic is locked and no more replies can be posted.