Preview in same window
3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 22, 2013 (RSS)
By crystal - April 22, 2013
Hi,
When in Adminsection - and editing a record. the 3 buttons top right hand corner SAVE | PREVIEW | CANCEL
is it possible to amend PREVIEW to open the preview in the same window (NOT A NEW WINDOW AS AT PRESENT)
many thanks in advance
Chris
By gregThomas - April 22, 2013
Hi Chris,
You can do this, but the problem is that if you have just saved a record, then preview it, when you clicked the back button most browses would display a warning asking you if wanted to resubmit the form. Another issue is that to make the change you have to alter core CMS Builder files, so if you upgrade the CMS at a later date, these changes will be lost.
To preview a record in the same window, you need to open cmsAdmin/lib/menus/default/edit_functions.js and around like 66 you should see this:
var form = document.createElement('form');
form.setAttribute('method', 'POST');
//form.setAttribute('target', '_blank');
form.setAttribute('action', $('#previewUrl').val()); // note that url includes special number 9999999999 getRecords() uses to know this is a preview request
for (i = 0; i < params.length; i++) {
You just need to comment out or remove the line highlighted in green. This only works when you're actually editing/creating a record. Let me know if also want this feature on a list page.
Cheers
Greg
PHP Programmer - interactivetools.com