I am in the process of setting up a form with CF5, the form has a dropdown which reads from the database a selection of vehicles.
Db where data is read from #__form_datatable_newvehicle
columns that I am interested in are: id, callsign, reg
I have setup the form in designer view with the following items.
custom - provides an area for free text at the beginning of the form
callsign - this is the dropdown which the vehicle callsign is selected from.
General Tab
Field - callsign
Field ID - callsign
options - 1=1 (I found when empty the dynamic function doesn't work.)
2=2
Empty Option - Select Vehicle
Label - Vehicle
All other options are empty on the general tab
Dynamic Data Tab
Enabled - yes
Data Path - vehicle_name
Value - callsign
Text Key - callsign
Validation and Events are both empty.
The Dynamic Dropdown is working correctly with the user being able to select the vehicle and it is saved to the DB for the form as is required.
The next field is the one which I wish to get the registration for of the vehicle selected in the dropdown.
Hidden Field - no need for it to be seen just the result saved in the database at the end.
General Tab
Field Name - reg
Field ID - reg
Value - This needs something I know.
Label - Registration
Going to the Setup Tab of the form I have the following details on the On Load Event
Custom Code - <?php
$user =& JFactory::getUser();
$form->data['name'] =& $user->name;
?>
This enters the name of the person into the form to save them from having to write it, this works correctly.
DB Read
Action Label - read_vehicle_names
Enabled - Yes
Table name - _form_datatable_newvehicle
Multi Read - Yes
Model ID - vehicle_name
Fields - id,callsign,reg
All other boxes are empty.
I believe that I need to add some php, either to the On Found box in a Custom Code box or in a Custom Code box below the DB Read and above the HTML Render box.
Despite reading plenty on the Forums and the FAQ's I am still struggling.😟 The data that is currently saved, I have got showing correctly in the front end using CC6.
Thanks in advance, Max and Bob...
I am now going to hide away and read Bob's book.
Db where data is read from #__form_datatable_newvehicle
columns that I am interested in are: id, callsign, reg
I have setup the form in designer view with the following items.
custom - provides an area for free text at the beginning of the form
callsign - this is the dropdown which the vehicle callsign is selected from.
General Tab
Field - callsign
Field ID - callsign
options - 1=1 (I found when empty the dynamic function doesn't work.)
2=2
Empty Option - Select Vehicle
Label - Vehicle
All other options are empty on the general tab
Dynamic Data Tab
Enabled - yes
Data Path - vehicle_name
Value - callsign
Text Key - callsign
Validation and Events are both empty.
The Dynamic Dropdown is working correctly with the user being able to select the vehicle and it is saved to the DB for the form as is required.
The next field is the one which I wish to get the registration for of the vehicle selected in the dropdown.
Hidden Field - no need for it to be seen just the result saved in the database at the end.
General Tab
Field Name - reg
Field ID - reg
Value - This needs something I know.
Label - Registration
Going to the Setup Tab of the form I have the following details on the On Load Event
Custom Code - <?php
$user =& JFactory::getUser();
$form->data['name'] =& $user->name;
?>
This enters the name of the person into the form to save them from having to write it, this works correctly.
DB Read
Action Label - read_vehicle_names
Enabled - Yes
Table name - _form_datatable_newvehicle
Multi Read - Yes
Model ID - vehicle_name
Fields - id,callsign,reg
All other boxes are empty.
I believe that I need to add some php, either to the On Found box in a Custom Code box or in a Custom Code box below the DB Read and above the HTML Render box.
Despite reading plenty on the Forums and the FAQ's I am still struggling.😟 The data that is currently saved, I have got showing correctly in the front end using CC6.
Thanks in advance, Max and Bob...
I am now going to hide away and read Bob's book.