Forums

Chronoforms module with SP call and redirect

hgaleano 16 May, 2015
Hi Everyone
I’m new in chronoforms (V5 and joomla 3.x), I will try to describe what I’m doing:
- I need to create a module with a simple form with 2 radio and a submit button. I need that when the user select an option and press the button, the code call a SP in database, and then redirect the control to another page.
- The form is configured with HTML Render without action URL
- In the OnSubmit event I have a custom code with the SP call and a redirect using the joomla sintax (JFactory::getApplication->redirect)
My problem is that is not working, the custom code just executes the SP call or the redirect code, not both of them. I tried with a custom code with just the SP call code, i have deleted the redirecting code and have added a redirect action at the end of OnSubmit event, but only the redirect is executed.
I don’t know if it is possible to do that with chronoforms, i’m doing something wrong? I need to make something else?. If it is not possible with chronoforms how can I do it? Any Idea?

Thanks in advance
Hugo
GreyHead 16 May, 2015
Hi Hugo,

What is an SP call? Is that a database read or save?

Exactly what custom code are you using? The line you posted is incomplete . . .

Bob
hgaleano 16 May, 2015
Hi Bob
Thanks for your answer, i apologize for lack of information. I added a custom code action in OnSubmit event. with the call to a Stored Procedure in database. I hope it explains a little bit more

Thanks

action label actUpdateSession

$session = JFactory::getSession();
$session_id = $session->getid();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$values = "'" . $session_id . "',0,'','UPC',". $form->data['txtSelectedCop'] ;
$query = $db->getQuery(true);
$query = 'CALL SP_PWEB_Adm_Session('. $values . ')';
$db->setQuery($query);
$db->query() ;

JFactory::getApplication()->redirect(MyURL);
GreyHead 16 May, 2015
Answer
Hi Hugo,

One quick possibility here, $db->query() has been replaced by $db->execute() in Joomla! 3, please see if that works. If not, I'll look more closely,

Bob
hgaleano 18 May, 2015
Thank you very much Bob. It works!
This topic is locked and no more replies can be posted.