Duplicating records?

16 posts by 7 authors in: Forums > CMS Builder
Last Post: December 20, 2011   (RSS)

By blukabm - August 19, 2008

I am curious if there is currently 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.

Thanks!

Re: [blukabm] Duplicating records?

By Dave - August 19, 2008

There's currently no automatic way to do that.

Another approach might be to set the default values for the fields in the field editor so when you create a new record it starts with those values.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Duplicating records?

By blukabm - August 20, 2008

Is that something that could be added through the custom programming option? If so, we may look into that.

Thanks!

Re: [blukabm] Duplicating records?

By Dave - August 20, 2008

Hi blukabm,

It can (as we're discussing over email) - another option might be to try and find a bookmarklet tool that would let you save the form data and re-output it.

I did a google search for "copy form values bookmarklet"
http://www.google.com/search?q=copy+form+values+bookmarklet

and found this site:
http://www.benjaminkeen.com/software/bookmarklet_generator/

I don't know if that will do exactly what you need or not but I thought it might be worth a look.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Duplicating records?

By Dave - August 21, 2008 - edited: March 18, 2010

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

It doesn't support uploads or all the field types but worked for this case. I'm posting in here in case it turns out to be useful for someone else as well.

- Create a backup copy of /lib/menus/default/edit.php
- Open /lib/menus/default/edit.php
- Search for showWysiwygGeneratorCode
- Add the code in red (about 15 lines above showWysiwygGeneratorCode)

<table border="0" cellspacing="0" cellpadding="0" width="690">
<tr>
<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>

<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() ?>


Update: This version works for 2.00+ - search for _action=save

<div style="float:right">

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


<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>

Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Duplicating records?

Talk about perfect timing! I just had a client who asked for this capability so I tried this and it works great!

Thanks Dave!

Kevin

Re: [sublmnl] Duplicating records?

By Jason - February 22, 2011

Hi,

We have a user submitted plugin that creates the "Save & Copy" button and functionality for you:

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

Hope this helps
---------------------------------------------------
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: [Jason] Duplicating records?

Thanks Jason, and that looks familiar...
And I remember why I couldn't use it.
Until I found this post today.



thanks!

Re: [sublmnl] Duplicating records?

Would be great is this also added a "Duplicate" link in the list view, next to View | Modify | Erase

:)