relatedRecords - Create

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 30, 2010   (RSS)

Is it possible from a list of relatedRecords to create a new relatedRecord, or are there any plans to introduce this?

I can see the 'modify' and 'erase' links, but it would be useful to add a 'create' link, even if it just started with a blank record (i.e. didn't have the 'related' field populated).

Thanks, Paul.

Re: [pothompson] relatedRecords - Create

By Jason - March 29, 2010

Hi,

Currently, there is no option to add a relatedRecord directly like that. However, it has been added to the requested function list.

There is a work around that you could try for now, though. Add a seperator to your section. Under field options, choose HTML and use the following code:


<tr>
<td colspan='2'>
<a href=admin.php?menu=*TABLENAME*&action=add&*RELATEDFIELD*=<?php echo$GLOBALS['RECORD']['*RELATEDFIELD']; ?>>Add Related Record</a>
</td>
</tr>


Change this code so that:
-*TABLENAME* = the name of the related table
-*RELATEDFIELD*= the name of the related field in that table

This will put a link below your related records. When you click on it, it will open an add window for you.

Let me know how this works for you.

Thanks for your input.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [pothompson] relatedRecords - Create

By Jason - March 30, 2010

Hi Paul,

I'm glad it pretty much worked. :)

Yeah, that solution will just bring you back to the list of projects. What it's doing is tricking the CMS into thinking you've clicked on the button to add a new record to the projects section. The "create" feature is on the requested functions list, however.

Good luck.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/