Cronoforms V4-checkbox_group populated by the DB table

tufo 17 Oct, 2012
Hello,

my goal is to populate a checkbox dynamically from a predefined table.

I have attached the data I post ..

But the check box is not created.

What's wrong?

Thank you.




Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => frontend-create-catalogo
[Itemid] =>
[UlulaChronoformsDataBackendCategoria] => Array
(
[0] => Array
(
[cf_id] => 1
[cf_uid] => 5e16677357b63f586d0223938d82987c
[cf_created] => 2012-10-08 11:41:01
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 0
[cf_modified_by] => 0
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 0
[ulu_backend_categoria] => Pittura
[input_submit_2] => Submit
)

[1] => Array
(
[cf_id] => 2
[cf_uid] => 1aa490c49270ffa5637d9c9458848cf2
[cf_created] => 2012-10-08 11:41:54
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 0
[cf_modified_by] => 0
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 0
[ulu_backend_categoria] => Fotografia
[input_submit_2] => Submit
)

[2] => Array
(
[cf_id] => 3
[cf_uid] => 87441a357fc505d03e0b006e6fd9f1b0
[cf_created] => 2012-10-08 11:42:08
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 0
[cf_modified_by] => 0
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 0
[ulu_backend_categoria] => Acquerello
[input_submit_2] => Submit
)

[3] => Array
(
[cf_id] => 4
[cf_uid] => 476bb993247f095535bed4d2b091c068
[cf_created] => 2012-10-08 11:42:17
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 0
[cf_modified_by] => 0
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 0
[ulu_backend_categoria] => Scultura
[input_submit_2] => Submit
)

[4] => Array
(
[cf_id] => 5
[cf_uid] => 69cf3c4bca81c00e61490779a634eda8
[cf_created] => 2012-10-08 11:42:25
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 0
[cf_modified_by] => 0
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 0
[ulu_backend_categoria] => Grafica
[input_submit_2] => Submit
)

)

)
Validation Errors:
Array
(
)
GreyHead 17 Oct, 2012
Hi tufo,

The Data Path box doesn't need the $form->data part of the name. Please see this FAQ

Bob
tufo 18 Oct, 2012
I'm sorry, but I do not understand.

if this is the array
Data Array:
array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => frontend-create-catalog
[Itemid] =>
[UlulaChronoformsDataBackendCategoria] => Array
(
[0] => Array
(
[cf_id] => 1
[cf_uid] => 5e16677357b63f586d0223938d82987c
[cf_created] => 10.08.2012 11:41:01
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 0
[cf_modified_by] => 0
[cf_ipaddress] => 127.0.0.1
[cf_user_id] => 0
[ulu_backend_categoria] => Painting
[input_submit_2] => Submit
)


What should I put in DataPath?

UlulaChronoformsDataBackendCategoria?
'UlulaChronoformsDataBackendCategoria'?
UlulaChronoformsDataBackendCategoria.ulu_backend_categoria?
ulu_backend_categoria?


Thank you.
GreyHead 18 Oct, 2012
Hi tufo,

Please try leaving the Data Path box empty.

Add cf_id,ulu_backend_categoria to the Fields box.

Then put cf_id and ulu_backend_categoria in theDynamic Data boxes of the CheckBox Group element.

Bob
tufo 18 Oct, 2012
Hi Bob,

I am attaching the settings I used.

I get this array
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => frontend-create-catalogo
[Itemid] =>
[UlulaChronoformsDataBackendCategoria] => Array
(
[0] => Array
(
[ulu_backend_categoria] => Pittura
)

[1] => Array
(
[ulu_backend_categoria] => Fotografia
)

[2] => Array
(
[ulu_backend_categoria] => Acquerello
)

[3] => Array
(
[ulu_backend_categoria] => Scultura
)

[4] => Array
(
[ulu_backend_categoria] => Grafica
)

)

)
Validation Errors:
Array
(
)


this is good.

But the checkbox is not populated on the front-end.

"Then put cf_id and ulu_backend_categoria in theDynamic Data boxes of the CheckBox Group element."

what is wrong?

thanks
GreyHead 18 Oct, 2012
Hi tufo,

The Value Key and Text Key boxes on the Dynamic Data tab are empty. Please go back and check the FAQ.

Bob
tufo 18 Oct, 2012
Hi Bob,

Thank you very much for your help.

Just for reference:

[UlulaChronoformsDataBackendCategoria] => Array
(
[0] => Array
(
[ulu_backend_categoria] => Pittura
)

With dynamic data parameters in my select box:
Data Path = UlulaChronoformsDataBackendCategoria
Text/Value Keys = ulu_backend_categoria

thanks.
GreyHead 18 Oct, 2012
Hi tufo,

Well done :-)

Bob
Austre 08 Nov, 2012
Let me "turn on" this post with my doubt that looks like previous.

In my form i inserted a Custom Code that execute a SP in my SQL Server and return 02 fields: id, name.


<?php
$conn = mssql_connect("MyServer", "MyUser", "MyPass");
$bco = mssql_select_db("MyDatabase", $conn);
$sql  = "exec rm_favorecido '%'";
$favorecido = mssql_query($sql,$conn);
?>


Now i need to put $favorecido into $form->data to populate the DropDown. I understand the configuration at Dynamic Data tab, but didn't realise how to bring $favorecido available to the form.
Austre 09 Nov, 2012
Hi guys!

I solved my problem today. The code is:

<?php

$conn = mssql_connect("MyServer", "MyUser", "MyUserPass");
$bco = mssql_select_db("MyDatabase", $conn);
$sql  = "exec rm_favorecido '%'";
$result = mssql_query($sql,$conn);
$favorecido = array();

while($row=mssql_fetch_array($result,MSSQL_ASSOC)){
$favorecido[] = $row;
}

mssql_close($conn);

$form->data['favorecido'] = $favorecido;

?>


The Dynamic Data Configuration was:
Data Path = favorecido
Value Key = id
Text Key = name

Thanks anyway!
This topic is locked and no more replies can be posted.