Hello, Bob
Maybe this is a silly question. But I've tried everything (or almost) to run the options of checkbox group and nothing. Read and reread and I can not do work the options of checkbox group.
There are four options, f.e., 1, 2, 3, and 4. I liked running a code according to the option that the user choose.
The my attempt ...
But it does not work ... 馃槦
Can you help me, please?
Show me the way and I'll walk ...馃榾
Thanks
Ant贸nio Gra莽a
Maybe this is a silly question. But I've tried everything (or almost) to run the options of checkbox group and nothing. Read and reread and I can not do work the options of checkbox group.
There are four options, f.e., 1, 2, 3, and 4. I liked running a code according to the option that the user choose.
The my attempt ...
$escolha_radio = $form-> data ['escolha_radio'];
if ($escolha_radio == '1') {
do something ...
}
But it does not work ... 馃槦
Can you help me, please?
Show me the way and I'll walk ...馃榾
Thanks
Ant贸nio Gra莽a
Hi Ant贸nio,
That looks OK apart from some extra spaces in $form->data['escolha_radio']
I'd use:
Bob
That looks OK apart from some extra spaces in $form->data['escolha_radio']
I'd use:
<?php
switch ( $form->data['escolha_radio'] ) {
case '1':
// do something
break;
case '2':
// do something else
break;
case '3':
// do something boring
break;
case '4':
// do something exciting
break;
}
?>
Bob
Hello, Bob
Thanks for the reply, but it still does not working. Choose all the options and returns nothing. Nor with the IF or the CASE condition. I do not understand.
I have a checkbox Group with the following settings:
Field Name: escolha_radio
Options:
Pista=Pista
Pista Coberta=Pista Coberta
Estrada=Estrada
Concursos=Concursos
Validation: 1 Required
On submit I have:
Handle Arrays (with no configuration)
Event Switcher [GH] with four options:
In each option have a costum code to make a listing under some conditions. Costum code work if out of Event Switcher.
Code Event Switcher [GH]:
Debuging:
The checkbox Group has some special configuration?
Ant贸nio Gra莽a
Thanks for the reply, but it still does not working. Choose all the options and returns nothing. Nor with the IF or the CASE condition. I do not understand.
I have a checkbox Group with the following settings:
Field Name: escolha_radio
Options:
Pista=Pista
Pista Coberta=Pista Coberta
Estrada=Estrada
Concursos=Concursos
Validation: 1 Required
On submit I have:
Handle Arrays (with no configuration)
Event Switcher [GH] with four options:
In each option have a costum code to make a listing under some conditions. Costum code work if out of Event Switcher.
Code Event Switcher [GH]:
<?php
switch ( $form->data['escolha_radio'] ) {
case 'Pista':
return 'event_a';
break;
case 'Pists Coberta':
return 'event_b';
break;
case 'Estrada':
return 'event_c';
break;
case 'Concursos':
return 'event_d';
break;
}
?>
Debuging:
Data Array:
Data Array:
Array
(
[chronoform] => marcas_evolucao_epocas_concursos-Copy
[event] => submit
[format] => html
[Itemid] => 1085
[option] => com_chronoforms
[view] => form
[escolha_radio] => Pista,Pista Coberta,Estrada,Concursos
[atleta_select] => Ant贸nio Cruz
[tooltip] =>
[filtrar] => Filtrar
[4aba64a93207732b1a9b1f084b7ed2d3] => 1
)
Validation Errors:
Array
(
)
The checkbox Group has some special configuration?
Ant贸nio Gra莽a
Hi Ant贸nio,
I'm sorry, I saw 'radio' in the earlier code and assumed it was a radio button group. It needs to be a bit different for a checkbox group. This code should go before the Handle Arrays action:
Bob
I'm sorry, I saw 'radio' in the earlier code and assumed it was a radio button group. It needs to be a bit different for a checkbox group. This code should go before the Handle Arrays action:
<?php
if ( in_array( 'Pista', $form->data['escolha_radio'] ) ) {
// do something
}
if ( in_array( 'Pista Coberta', $form->data['escolha_radio'] ) ) {
// do something
}
if ( in_array( 'Estrada', $form->data['escolha_radio'] ) ) {
// do something
}
if ( in_array( 'Concursos', $form->data['escolha_radio'] ) ) {
// do something
}
?>
Bob
Hi, Bob
Work fine, now. Many Thanks.
But you missing a bracket. :mrgreen: The corret code:
But now I notice the checkbox differently behaves according to the browsers. In Opera does not appear the box to select but it can possible select. In chrome and FF it's okay.
Is there a solution for this?
Thanks, again.
Ant贸nio Gra莽a
Work fine, now. Many Thanks.
But you missing a bracket. :mrgreen: The corret code:
if ( in_array( 'Pista', $form->data['escolha_radio'] )) {
// do something
}
But now I notice the checkbox differently behaves according to the browsers. In Opera does not appear the box to select but it can possible select. In chrome and FF it's okay.
Is there a solution for this?
Thanks, again.
Ant贸nio Gra莽a
Hi Ant贸nio,
I'd guess that's just a CSS problem in the way that the checkbox is styled. Some browsers seem to add borders others don't (or it might be that the template hides the border in some cases).
Sorry about the missing ) - I've updated my original post to fix it.
Bob
I'd guess that's just a CSS problem in the way that the checkbox is styled. Some browsers seem to add borders others don't (or it might be that the template hides the border in some cases).
Sorry about the missing ) - I've updated my original post to fix it.
Bob
Hi, Bob
Thanks for replay.
One more time, thanks for your (big) help in forum.
Ant贸nio Gra莽a
Thanks for replay.
One more time, thanks for your (big) help in forum.
Ant贸nio Gra莽a
This topic is locked and no more replies can be posted.