Hello,
I have inserted some curly brackets, {field},into the Field Default Value entry in order to load data from a table and it is pulling the info properly. However, when there is no data found it logically comes back with {field}. Is there a way to load an empty space instead of {field} when there isn't any data?
Thanks
I have inserted some curly brackets, {field},into the Field Default Value entry in order to load data from a table and it is pulling the info properly. However, when there is no data found it logically comes back with {field}. Is there a way to load an empty space instead of {field} when there isn't any data?
Thanks
Hi swmckay,
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.
The DB Record Loader in CFv4 should handle that case OK.
Bob
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.
The DB Record Loader in CFv4 should handle that case OK.
Bob
Greyhead,
Yes I am using CFv4. It loads correctly if there is data in the record but when there is no data it comes back with the Default Field Value such as {field}. Perhaps I have added it to the field when I set it up.
Yes I am using CFv4. It loads correctly if there is data in the record but when there is no data it comes back with the Default Field Value such as {field}. Perhaps I have added it to the field when I set it up.
Hi swmckay ,
I'm a bit surprised that you don't get an empty value but don't have time to go digging in the code right now.
I think that a workaround is to add a Custom Code action after the DB Load and before the Show HTML
Bob
I'm a bit surprised that you don't get an empty value but don't have time to go digging in the code right now.
I think that a workaround is to add a Custom Code action after the DB Load and before the Show HTML
<?php
if ( !isset($form->data['field']) ) {
$form->data['field'] = '';
}
?>Bob
Hi,
Indeed this is how the curly brackets replacer works, it tries to replace the existing data array keys, it can't predict non existent ones, I suggest that you do something in the "no record found event".
Also, there is no reason you would insert curly brackets into the field default values, the values would be set automatically if there are matching data keys, and if not then they would be left empty, so the simplest answer is to remove those curly brackets strings.
Regards,
Max
Indeed this is how the curly brackets replacer works, it tries to replace the existing data array keys, it can't predict non existent ones, I suggest that you do something in the "no record found event".
Also, there is no reason you would insert curly brackets into the field default values, the values would be set automatically if there are matching data keys, and if not then they would be left empty, so the simplest answer is to remove those curly brackets strings.
Regards,
Max
This topic is locked and no more replies can be posted.
