Duplicating records?
16 posts by 7 authors in: Forums > CMS Builder
Last Post: December 20, 2011 (RSS)
By blukabm - August 19, 2008
Thanks!
Re: [blukabm] Duplicating records?
By Dave - August 19, 2008
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!
interactivetools.com
Re: [Dave] Duplicating records?
By blukabm - August 20, 2008
Thanks!
Re: [blukabm] Duplicating records?
By Dave - August 20, 2008
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!
interactivetools.com
Re: [Dave] Duplicating records?
By Dave - August 21, 2008 - edited: March 18, 2010
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>
interactivetools.com
Re: [Dave] Duplicating records?
By kevbarker - August 22, 2008
Thanks Dave!
Kevin
Re: [kevbarker] Duplicating records?
By sublmnl - February 21, 2011 - edited: February 21, 2011
<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" />
<?php
$buttonsRight = '';
$buttonsRight .= "<input class='button' type='submit' name='_action=save' value='" .t('Save'). "' />\n";
if ($previewUrl) {
$buttonsRight .= "<input class='button' type='button' name='preview' value='" .t('Preview'). "' onclick=\"editPreview();\" />\n";
}
$buttonsRight .= "<input class='button' type='button' name='cancel' value='" .t('Cancel'). "' onclick=\"editCancel();\" />\n";
$buttonsRight = applyFilters('edit_buttonsRight', $buttonsRight, $tableName, $GLOBALS['RECORD']);
echo $buttonsRight;
?>
</div>
This kind of works.
Perhaps its the newer version of CMSB. I noticed that your code is a little different than the above which is what I have.
I have to make the image upload field not required in order to make a copy.
Dave can you update this?
THanks
Re: [sublmnl] Duplicating records?
By Jason - February 22, 2011
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?
By sublmnl - February 23, 2011
And I remember why I couldn't use it.
Until I found this post today.
thanks!
Re: [sublmnl] Duplicating records?
:)