I am using chronoforms v6 and noticed that in many cases there is no need to create extra code for some functions.
I am counting the number of records in a database and hovering LOOP to generate a list for a DROPDOWN ...
Example: I find that I have 4 records in a database, how to dynamically feed a DROPDOWN with the "1,2,3,4" choice options?
Is there a way to implement without generating extra code?
I am counting the number of records in a database and hovering LOOP to generate a list for a DROPDOWN ...
Example: I find that I have 4 records in a database, how to dynamically feed a DROPDOWN with the "1,2,3,4" choice options?
Is there a way to implement without generating extra code?
There's a dynamic dropdown example in the demo forms.
I am using a PHP to populate the dropdown with a count of database records, one same works well plus I have to get the maximum value of records that comes from the amount of records in the database. The value is in read_data15 it indicates that it is number 3, however when using in "for" this value is ZERO ...
//return array("Ponto 1","Ponto 2","Ponto 3","Ponto 4",);
$results = array();
$quant = '{var:read_data15}';
$results[] = 'Selecione o ponto desejado';
for ($i = 1; $i <= $quant; $i++) {
$results[] = 'Ponto '.$i;
}
return $results;
how can I get around this problem?
//return array("Ponto 1","Ponto 2","Ponto 3","Ponto 4",);
$results = array();
$quant = '{var:read_data15}';
$results[] = 'Selecione o ponto desejado';
for ($i = 1; $i <= $quant; $i++) {
$results[] = 'Ponto '.$i;
}
return $results;
how can I get around this problem?
//return array("Ponto 1","Ponto 2","Ponto 3","Ponto 4",);
$results = array();
$quant = '{var:read_data15}';
$results[] = 'Selecione o ponto desejado';
for ($i = 1; $i <= $quant; $i++) {
$results[] = 'Ponto '.$i;
}
return $results;
$results = array();
$quant = '{var:read_data15}';
$results[] = 'Selecione o ponto desejado';
for ($i = 1; $i <= $quant; $i++) {
$results[] = 'Ponto '.$i;
}
return $results;
var:read_data.model
return '{var:read_data15}';
by simply testing with this I get the value 3 ...
by simply testing with this I get the value 3 ...
Healyhatman...
thus ?
$results = array();
$quant = '{var:read_data15.model}';
$results[ ] = 'Selecione o ponto desejado';
for ($i = 1; $i <= $quant; $i++) {
$results[ ] = 'Ponto '.$i;
}
return $results;
thus ?
$results = array();
$quant = '{var:read_data15.model}';
$results[ ] = 'Selecione o ponto desejado';
for ($i = 1; $i <= $quant; $i++) {
$results[ ] = 'Ponto '.$i;
}
return $results;
m are you sure it's 3, or is it an array containing the number 3
I am counting records through the option below in read_data15 and currently have 3 records ... I need this value inside the "for" to be able to create 3 elements in the array that goes to the dropdown when returning from PHP
the read_data15...
Select type = Return the count of records matching the filtering conditions.
the read_data15...
Select type = Return the count of records matching the filtering conditions.
Oh sorry I see the problem. You can't use shortcode a in PHP.
{var:} should be $this->get("variable name", "default if not found");
{var:} should be $this->get("variable name", "default if not found");
I just told you? What is it you're asking?
Thanks, follow a link to video with the implementation.
https://youtu.be/mkr_460kmuM
https://youtu.be/mkr_460kmuM
$quant = $this->get("read_data15", 0);
You didn't read what I wrote properly, $this->get takes two parameters - the name of the variable you want to retrieve, and a default value if the variable is not found.
You didn't read what I wrote properly, $this->get takes two parameters - the name of the variable you want to retrieve, and a default value if the variable is not found.
Also try doing
return json_encode($results);
and in the dropdown value put
{var/jsonde:php17}
return json_encode($results);
and in the dropdown value put
{var/jsonde:php17}
Thanks a lot for the guidance, you are correct ... however the implementation described in the video is working correctly ... at the time I noticed that $ this in the chronoforms is an access to the entire structure of the project simply by knowing how to access the desired variables, thank you...
Throughout my code I will certainly have other doubts, thank you very much.
Throughout my code I will certainly have other doubts, thank you very much.
This topic is locked and no more replies can be posted.