DUPLICATING A RECORD INSTEAD OF RE-ENTERING THE DATA - Dec 29th, 2018


NOTE:
This function has been turned into a free plugin that you can access at

http://www.interactivetools.com/add-ons/detail.php?Save-Copy-Button-1030

This plugin requires at least CMSB Version 2.11. The information below is implementation into earlier versions.


User blukabm was curious if there was a way to duplicate a record. “That way I could modify the copied record instead
of creating a new one and re-entering data that won't change much.”

Dave Edis from Interactive Tools came up with an answer for both versions before and after 2.x

He said:

“Here's an (unsupported) hack I wrote up to add a "Save as Copy" button to the bottom left of the edit page.

(Note:) It doesn't support uploads or all the field types.”

- Create a backup copy of /lib/menus/default/edit.php
- Open /lib/menus/default/edit.php

FOR CMSB VERSIONS PRIOR TO 2.X

- Search for: showWysiwygGeneratorCode

- Add this code:



<td>
<input type="submit" name="action=save" value="<?php _e('Save as Copy') ?>"
onclick="document.getElementById('num').value='';
document.getElementById('preSaveTempId').value='1234567890abc'"
class="inputButton" />
</td>


to the existing code(about 15 lines above showWysiwygGeneratorCode)



<table border="0" cellspacing="0" cellpadding="0" width="690">
<tr>
<!-- Insert This Code -->
<td>
<input type="submit" name="action=save" value="<?php _e('Save as Copy') ?>"
onclick="document.getElementById('num').value='';
document.getElementById('preSaveTempId').value='1234567890abc'"
class="inputButton" />
</td>
<!-- End of Insert-->
<td align="right">
<input type="submit" name="action=save" value="<?php _e('Save') ?>" class="inputButton" />
<input type="button" name="cancel" value="<?php _e('Cancel') ?>" class="inputButton"
onclick="window.location='?menu=<?php print urlencode($menu) ?>'" />
</td>
</tr>
</table>
</form>

<?php showWysiwygGeneratorCode() ?>


FOR CMSB VERSION 2.X AND ABOVE

search for: "_action=save"

HINT: It occurs in 2 places line 34 and line 72
Add this code to the existing code in both places.



<input type="submit"
name="action=save"
value="<?php et('Save As Copy') ?>"
onclick="document.getElementById('num').value='';
document.getElementById('preSaveTempId').value='1234567890abc'"
class="button" />




<div style="float:right">
<!-- Insert This Code -->
<input type="submit"
name="action=save"
value="<?php et('Save As Copy') ?>"
onclick="document.getElementById('num').value='';
document.getElementById('preSaveTempId').value='1234567890abc'"
class="button" />
<!-- End of Insert-->
<input class="button" type="submit" name="_action=save" value="<?php et('Save') ?>" />
<input class="button" type="button" name="cancel" value="<?php et('Cancel') ?>"
onclick="window.location='?menu=<?php print urlencode($menu) ?>'" />
</div>



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service