Hello.
I use Chronoforms to edit a row from ChronoConnectivity.
All works perfectly fine, except for a detail.
When i use a "dropdown list" with a list of values, Chronoforms find correctly the value stored in the row an add
Example :
When i use a "dropdown list" with a dynamically build list, Chronoforms does not find the selected value. And I do not find the name of the variable to check ...
Example :
Does anybody have a solution , please ?
I use Chronoforms to edit a row from ChronoConnectivity.
All works perfectly fine, except for a detail.
When i use a "dropdown list" with a list of values, Chronoforms find correctly the value stored in the row an add
selected='selected'
to tag <option>.Example :
<select name="pays" id="pays" >
<option selected="selected" value="FRANCE">FRANCE</option>
<option value="BELGIQUE">BELGIQUE</option>
<option value="LUXEMBOURG">LUXEMBOURG</option>
</select>
When i use a "dropdown list" with a dynamically build list, Chronoforms does not find the selected value. And I do not find the name of the variable to check ...
Example :
<select name="pays" id="pays">
<?php
foreach ( $pays as $p => $n ) {
$s = '';
if ( ????? == $p ) {
$s = "selected='selected'";
}
echo "<option value='$p' $s >$n</option>";
}
</select>
Does anybody have a solution , please ?
Hi CHIESA,
ChronoForms can’t see HTML generated by PHP so you need to set the selected value yourself. I think that the data is passed in a $row object so the code would be something like this:
Bob
ChronoForms can’t see HTML generated by PHP so you need to set the selected value yourself. I think that the data is passed in a $row object so the code would be something like this:
<select name="pays" id="pays">
<?php
foreach ( $pays as $p => $n ) {
$s = '';
if ( $row->pays == $p ) {
$s = "selected='selected'";
}
echo "<option value='$p' $s >$n</option>";
}
</select>
Bob
Hi, Greyhead.
A lot of thanks for this answer.
I understand the problem.
I have tried your solution, but unfortunately it does not work.
It seems that $row is empty. i have tried also $cf_row, $chronoform_row, and a lot of other names, but in vain.
...
Best regards
A lot of thanks for this answer.
I understand the problem.
I have tried your solution, but unfortunately it does not work.
It seems that $row is empty. i have tried also $cf_row, $chronoform_row, and a lot of other names, but in vain.
...
Best regards
Hi CHIESA,
Soory about that . . . I don't use the built-in links but create my own links to the ChronoForm so I know exactly what data is there. I'll try to test it out later.
Bob
Soory about that . . . I don't use the built-in links but create my own links to the ChronoForm so I know exactly what data is there. I'll try to test it out later.
Bob
Hi CHIESA,
I got the values of $row with this code:
Bob
I got the values of $row with this code:
<?php
if ( !$mainframe->isSite() ) { return; }
$connectionname = JRequest::getString('connectionname', '', 'get');
$MyConnection =& CFChronoConnection::getInstance($connectionname);
$rowid = JRequest::getInt('cids', '', 'get');
$row =& JTable::getInstance(str_replace($mainframe->getCfg('dbprefix'), '', $MyConnection->connectionrow->tablenames), 'Table');
$row->load($rowid);
//echo'<div>$row->text_0: '.print_r($row->text_0, true).'</div>';
?>
Bob
This topic is locked and no more replies can be posted.