Edit another record within CMSB
6 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: April 3, 2014 (RSS)
By Toledoh - April 1, 2014
Hi Guys.
In a table, I have a field that looks up records from another table. (ie. list field with "Get options from Database" where the table is "Company", Value = num, Label = title)
Is there a way that I can add a field description like "<a href=... " that will then link to that record for editing? Similar to a related tables look-up by in the opposite direction?
Tim (toledoh.com.au)
By Chris - April 2, 2014
Hi Tim,
I made a plugin which does this a while back. I submitted it to our Add Ons system for you so you can download it and check it out. Please let me know what you think! :)
http://www.interactivetools.com/add-ons/list-field-jump/
Chris
By Toledoh - April 2, 2014
Would it be hard to make it "save and jump" so if you select a record from the drop down, then click the link, it saves the current record prior to opening the linked record.
Tim (toledoh.com.au)
By Chris - April 3, 2014
The current plugin opens the foreign record in a new tab/window.
Hmm, that's a tricky one. You could try replacing the preg_replace() line in the plugin with the following:
$html = preg_replace(
'#(</select>)#',
'\\1 <a href="?dynamicURL" onclick="'
. 'var num = $(this).prev().val(); if (num) { $(\'#returnUrl\').val(\'' . htmlencode($editUrl) . '\' + num); $(\'FORM\').submit(); }'
. ' return false;">⇨</a>',
$html
);
Hope this helps!
Chris
By Toledoh - April 3, 2014
Works just like it says on the label!
I've gotta think up stuff trickier for you Chris - this is too easy:)
Tim (toledoh.com.au)