Hi all,
I am preparing the new form and I want to use dropdowns and checkboxes and I have some questions.
[list]May I use enum data type in DB for save from checkboxes? it saves as an array and it throws an error.
what data type Should I have in DB?[/list]
[list]May I combine dynamic dropdown with checkboxes? how?[/list]
I am preparing the new form and I want to use dropdowns and checkboxes and I have some questions.
[list]May I use enum data type in DB for save from checkboxes? it saves as an array and it throws an error.
1054 Unknown column 'Array'
what data type Should I have in DB?[/list]
[list]May I combine dynamic dropdown with checkboxes? how?[/list]
Hello homeopat,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I build a select drop-down, radio button or checkbox group?
How can I get useful data from select drop-downs, checkboxes and radio buttons?
What are the differences between select drop-downs, radio buttons and checkboxes?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I build a select drop-down, radio button or checkbox group?
How can I get useful data from select drop-downs, checkboxes and radio buttons?
What are the differences between select drop-downs, radio buttons and checkboxes?
P.S: I'm just an automated service😉
Hi Homeopat,
I've never tried using the enum data type. Usually for multiple valued checkboxes use a Handle Arrays action to convert the values to a comma separated string and save the string in a column of Type VARCHAR()
Bob
I've never tried using the enum data type. Usually for multiple valued checkboxes use a Handle Arrays action to convert the values to a comma separated string and save the string in a column of Type VARCHAR()
Bob
Hi Bob,
Calculus00s links helped me - I did it and it works.
Now I need to deal with the second part of my question.
I need to decide by selecting an option from a dropdown menu which Checkboxes will be displayed.
I peered into the FAQ and I know that I need to create multiple groups of checkboxes, but I do not know how to show one group of checkboxes based on the selected option from the dropdown menu.
thx
Calculus00s links helped me - I did it and it works.
Now I need to deal with the second part of my question.
I need to decide by selecting an option from a dropdown menu which Checkboxes will be displayed.
I peered into the FAQ and I know that I need to create multiple groups of checkboxes, but I do not know how to show one group of checkboxes based on the selected option from the dropdown menu.
thx
Hi homeopat.
What exactly needs to change. Is is a single set of checkboxes and you select different sub-sets? Or is it that you need to display a completely different checkbox group for each option?
Bob
What exactly needs to change. Is is a single set of checkboxes and you select different sub-sets? Or is it that you need to display a completely different checkbox group for each option?
Bob
yes,
If I select option 1 then I need show checkboxes 1,2,3
If I select option 2 then I need show checkboxes 4,5,6
and so on
so I'll have to create many groups of checkboxes as options in the dropdown menu?
but then I have to modify php code of converting array to comma separated string.
could u pls help me?
If I select option 1 then I need show checkboxes 1,2,3
If I select option 2 then I need show checkboxes 4,5,6
and so on
so I'll have to create many groups of checkboxes as options in the dropdown menu?
but then I have to modify php code of converting array to comma separated string.
could u pls help me?
Your checkboxes groups can be inside a container of type "div" each, then you can use the "Events" section in your dropdown to hide/show the container you want.
Regards,
Max
Regards,
Max
Hi Max,
If I understand correctly, my idea was correct. as many options in the dropdown menu as I have to create checkbox groups. I can not put all the checkboxes to one group?
I did try to do it this way, but it didnt work.
I followed this FAQ http://www.chronoengine.com/faqs/70-cfv5/5232-how-do-i-build-a-dynamic-drop-down-in-cfv5.html and ["Please select a category"] is showing after loading the page.
If I understand correctly, my idea was correct. as many options in the dropdown menu as I have to create checkbox groups. I can not put all the checkboxes to one group?
I did try to do it this way, but it didnt work.
I followed this FAQ http://www.chronoengine.com/faqs/70-cfv5/5232-how-do-i-build-a-dynamic-drop-down-in-cfv5.html and ["Please select a category"] is showing after loading the page.
I resume what I did.
in designer
i use model_id=him
I have dropdown menu with name=him[druh] and id=dropdown3. there I have defined events tab
[attachment=0]ScreenShot799.jpg[/attachment]
I have one group of checkboxes with name=him[vlastnost][] and id=checkbox_group5
in setup
all data are loaded dynamically from only one DB table correctly over 2 DB reads.
1 DB read loads data for dropdown menu with model id=druhy
1 DB read loads data for checkboxes with model id=vlastnosti.
I put custom code between DB reads and HTML (Render Form):
what I did wrong?
in designer
i use model_id=him
I have dropdown menu with name=him[druh] and id=dropdown3. there I have defined events tab
[attachment=0]ScreenShot799.jpg[/attachment]
I have one group of checkboxes with name=him[vlastnost][] and id=checkbox_group5
in setup
all data are loaded dynamically from only one DB table correctly over 2 DB reads.
1 DB read loads data for dropdown menu with model id=druhy
1 DB read loads data for checkboxes with model id=vlastnosti.
I put custom code between DB reads and HTML (Render Form):
<?php
$options = array();
if (!$form->data['vlastnosti'] || count($form->data['vlastnosti']) < 1 )
{
// no result was found
$options[] = 'Please select a category';
}
else
{
foreach ($form->data['vlastnosti'] as $d)
{
$options[$d['vlastnosti']] = $d['vlastnosti'];
}
}
echo json_encode($options);
?>
what I did wrong?
I made some tries and found out that it works but not in time.
If I open new empty form and choose option on Druh HIM field then nothing is shown in Vlastnost HIM field.
[attachment=0]ScreenShot800.jpg[/attachment]
but If I open existing record, then the option in Vlastnost HIM field is shown
[attachment=1]ScreenShot801.jpg[/attachment]
it looks like the ajax isnt working or where is problem?
thx
If I open new empty form and choose option on Druh HIM field then nothing is shown in Vlastnost HIM field.
[attachment=0]ScreenShot800.jpg[/attachment]
but If I open existing record, then the option in Vlastnost HIM field is shown
[attachment=1]ScreenShot801.jpg[/attachment]
it looks like the ajax isnt working or where is problem?
thx
Hi homeopat,
Please post a link to the form so I can take a quick look. It's hard to work out what is happening from the images here.
I did notice that you have used '' for empty options, I had some problems with this and found that leaving the box empty seemed to work better.
Bob
Please post a link to the form so I can take a quick look. It's hard to work out what is happening from the images here.
I did notice that you have used '' for empty options, I had some problems with this and found that leaving the box empty seemed to work better.
Bob
Hi Bob
Here is the link http://portal.wiky.cz/portal2/index.php?option=com_chronoforms5&chronoform=edit_him and I send you form backup too.
do you mean leave empty options in the events of the dropdown menu element?
Here is the link http://portal.wiky.cz/portal2/index.php?option=com_chronoforms5&chronoform=edit_him and I send you form backup too.
do you mean leave empty options in the events of the dropdown menu element?
here is the link to edit existing record where u can see, that it works http://portal.wiky.cz/portal2/prehledy/evidence-him?cont=lists&ccname=evidencehim&act=edit&gcb=1
Hi homeopat,
Just leave the "value" box in the event totally empty if you want to trigger the event on empty value, don't use quotes at all since the empty value is actually an empty string.
Regards,
Max
Just leave the "value" box in the event totally empty if you want to trigger the event on empty value, don't use quotes at all since the empty value is actually an empty string.
Regards,
Max
Hi Max,
I did it and nothing happened. When I choose an option in dropdown memu (druh him) then no option is not shown in row checkbox (Vlastnost him).
It looks like that ajax doesnt work.
I did it and nothing happened. When I choose an option in dropdown memu (druh him) then no option is not shown in row checkbox (Vlastnost him).
It looks like that ajax doesnt work.
Then most probably the event setup is incorrect, please post the current events you have!
I have 2 events:
on load
[list=]2 db reads for dropdown (path:druhy) and for checkboxes (path:vlastnosti)[/list]
[list=]custom code[/list]
[list=3]html renderer[/list]
on submit
[list=1]custom code[/list]
[list=2]Connection Action[/list]
on load
[list=]2 db reads for dropdown (path:druhy) and for checkboxes (path:vlastnosti)[/list]
[list=]custom code[/list]
<?php
$options = array();
if (!$form->data['vlastnosti'] || count($form->data['vlastnosti']) < 1 )
{
// no result was found
$options[] = 'Please select a category';
}
else
{
foreach ($form->data['vlastnosti'] as $d)
{
$options[$d['vlastnost']] = $d['vlastnost'];
}
}
//echo json_encode($options);
?>
[list=3]html renderer[/list]
on submit
[list=1]custom code[/list]
// converts array to string
$vlastnost_array = array
(
'1 osoba' => '1 osoba',
'2 osoby' => '2 osoby',
'2m' => '2m',
'3 osoby' => '3 osoby',
'3m' => '3m',
'4 kanálový' => '4 kanálový',
'8 kanálový' => '8 kanálový',
'all-in-one' => 'all-in-one',
'barová' => 'barová',
'DVR' => 'DVR',
'elektronický' => 'elektronický',
'klasická' => 'klasická',
'klasický' => 'klasický',
'křížový' => 'křížový',
'mechanický' => 'mechanický',
'nízké' => 'nízké',
'plochý' => 'plochý',
'pronájem' => 'pronájem',
'průmyslový' => 'průmyslový',
'přenosný' => 'přenosný',
'skládací' => 'skládací',
'stojan' => 'stojan',
'vlastni' => 'vlastni',
'vysoké' => 'vysoké'
);
$vlastnost = array();
foreach ( $form->data[him]['vlastnost'] as $v )
{
$vlastnost[] = $vlastnost_array[$v];
}
$form->data[him]['vlastnost'] = implode(', ', $vlastnost);
?>
[list=2]Connection Action[/list]
Then, what do you do with the variable
$options
after you set it ?
Hi MaX,
I am not sure what do u mean? I just followed this faq how-do-i-build-a-dynamic-drop-down-in-cfv5
I modified previous settings.. Deleted db read and custom code from on load action and move them to on ajax action. but still not working. I combine dropdonw with checkbox group.
thx
I am not sure what do u mean? I just followed this faq how-do-i-build-a-dynamic-drop-down-in-cfv5
I modified previous settings.. Deleted db read and custom code from on load action and move them to on ajax action. but still not working. I combine dropdonw with checkbox group.
thx
Hi Max,
could u please help me with this?
thx
could u please help me with this?
thx
Hi homeopat,
Looking at the form with the link you posted I can see that you still have '' in the event selectors, that is probably breaking the JavaScript there. In the form backup I can still see that in the vlasnost checkbox group.
I can't work out what your Ajax code is doing. It appears to be taking the values in vlastnost and turning them into an options list for vlastnost. Does it change anything?
I also can't work out what the Custom Code in the On Submit event is doing - it appears to be processing the $form->data[him]['vlastnost'] array but as far as I can see it doesn't actually change anything.
Bob
Looking at the form with the link you posted I can see that you still have '' in the event selectors, that is probably breaking the JavaScript there. In the form backup I can still see that in the vlasnost checkbox group.
I can't work out what your Ajax code is doing. It appears to be taking the values in vlastnost and turning them into an options list for vlastnost. Does it change anything?
I also can't work out what the Custom Code in the On Submit event is doing - it appears to be processing the $form->data[him]['vlastnost'] array but as far as I can see it doesn't actually change anything.
Bob
Hi Bob,
I must say that I am lost with this problem. I just followed this FAQ. I resume what I did.
First in designer
put dropdown menu with id=drobdown3 and set some options to choose and set events
[attachment=0]ScreenShot818.jpg[/attachment]
put checkbox group with id=checkbox_group5 fill in all possible options in options field (faq doesnt say how set up second dropdown although I use checkbox group). I have try use dynamic data with path vlastnosti, but it didnt help.
Second in setup tab
created event with name ajax
put db read with model: vlastnosti; fields: empty and conditions:
put custom code:
checkbox group doesnt show some options depending on the selected option in dropdown menu after this settings.
I am not sure what I am doing wrong or if I forget something or If ajax doesnt work correctly.
thank you.
I must say that I am lost with this problem. I just followed this FAQ. I resume what I did.
First in designer
[attachment=0]ScreenShot818.jpg[/attachment]
Second in setup tab
<?php return array('druh' => $form->data['dropdown3']);?>
<?php
$options = array();
if (!$form->data['vlastnosti'] || count($form->data['vlastnosti']) < 1 )
{
// no result was found
$options[] = 'Please select a category';
}
else
{
foreach ($form->data['vlastnosti'] as $d)
{
$options[$d['vlastnost']] = $d['vlastnost'];
}
}
echo json_encode($options);
?>
checkbox group doesnt show some options depending on the selected option in dropdown menu after this settings.
I am not sure what I am doing wrong or if I forget something or If ajax doesnt work correctly.
thank you.
I think "set options" and "set dynamic options" will only work for dropdowns, they can't build a checkboxes group!
Hi Max,
But it works, but not immediately, correct ckeckboxes are shown (dependent on selected option in dropdown) after saving and open the record .... looks like a problem with ajax ... I am not sure if u understand me ...
But it works, but not immediately, correct ckeckboxes are shown (dependent on selected option in dropdown) after saving and open the record .... looks like a problem with ajax ... I am not sure if u understand me ...
I understand, the AJAX is not made to create a list of checkboxes, only to publish a dropdown options!
OK, I thought that.
but could u help me with this problem?
I need to show group of checkbox depending on choosing of dropdown.
1 option in dropdown can have more than 1 option in checkbox group.
but could u help me with this problem?
I need to show group of checkbox depending on choosing of dropdown.
1 option in dropdown can have more than 1 option in checkbox group.
This topic is locked and no more replies can be posted.