Forums

Problem with radio button and event switcher

parsifaltheking 03 Jun, 2015
Hi, i've a problem with chronoforms and chronoconnectivity:

I've a chronoconnectivity form that have a table with a column that i can click and open a chronoforms form in witch i can select Yes or No with a radio button and button save.
So i've the necessity that if i check yes and save the form send an email to an adress; but if i check no i send an email to another address.
But the problem is that the radio button value is checked in according to the value of db field read when the form is loaded and the name of the checkbox is: richiestaferie[accettate] and the value is NO=NO and YES=YES

I've created an event switcher that have this code:
<?php
switch ($form->data['accettate']) {
case 'SI':
    return 'SI';
    break;
  case 'NO':
    return 'NO';
    break;
}?>
GreyHead 03 Jun, 2015
Hi parsifaltheking,

If the name of the checkbox is richiestaferie[accettate] should the switch be?
switch ($form->data['richiestaferie']['accettate']) {
It's not possible to tell from what is here :-(

Bob
wlwan 16 Jun, 2015
Hi parsifaltheking,
I have shared the same problems with you and can't find any answer....

I did put the model id in the switch as well but still fail...
Try to enable the debug but it show lots of message which I don't understand...

If you find out the solution, would you mind update me here? (or pm is also fine....)
Thanks a lot.
wlwan 16 Jun, 2015
Some more addition information to share and hope someone can point me out where I did wrong...

Events action: quotation, complaints, feedback, partner
<?php
switch ($form->data['subject']['interest']) {
case 'quotation':
    return 'quotation';
    break;
  case 'complaints':
    return 'complaints';
    break;
  case 'feedback':
    return 'feedback';
    break;
  case 'partner':
    return 'partner';
    break;
}?>
GreyHead 16 Jun, 2015
Hi wlwan,

The Events tab is for linking JavaScript function so it is not relevant here - you should possibly delete those events to avoid JavaScript errors.

Looking at the Event tab image it loos as if the option values are 0, 1, 2, . . . while your PHP is looking for the values complaints, feedback, . . . so it will never be triggered.

The simplest solution is to edit the options list so that instead of looking like this
=Quotation
1=Complaints
2=Feedback
3=Partner
it is
quotation=Quotation
complaints=Complaints
feedback=Feedback
partner=Partner


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