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?

Cheers,

Tim (toledoh.com.au)

By Toledoh - April 2, 2014

Wow - how cool is that?!

Thanks!

Cheers,

Tim (toledoh.com.au)

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.

Cheers,

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;">&#x21E8;</a>',
  $html
);

Hope this helps!

All the best,
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:)

Cheers,

Tim (toledoh.com.au)