CoreBOSBB

Full Version: Autofilling fields from one module to antoher
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This one took me some time to figure out, and in the end it was dead-simple:

Let's say you want to create a module, of which the records can be created using an entry from another module as the starting point. So you create an action link in the source module's action column that includes the record ID from that source module in the query params.

Now you have a UI10 field in your new module that needs to be filled out with that record. Just edit "CreateView.php" in your new module and add:

PHP Code:
if (isset($_REQUEST['source_id']) && $_REQUEST[source_id'] != '') {
 $focus->column_fields['
your_module_column_name'] = $_REQUEST['source_id'];


Before the smarty BLOCKS are assigned. This will take care of the rest. The source_id is your query param, the columnname is the field/column name in your new module, where you want the link to take place.

Hope this helps someone.
In fact, it is even easier than that. Try putting the destination field directly in the action URL, like this:


Code:
..&your_module_column_name=$RECORD$

that should fill in the field for you directly.

In general you can set the value for any field on the module when creating by setting it's value in the URL
Nice!
You can even take this a step further with (Field) Mapping Business Mapping
http://corebos.org/documentation/doku.php?id=en:adminmanual:businessmappings:mapping