Forum Discussion
Unfortunately the record is a template project and could be copied several times over. I am wondering if I can open the code page in a pop-up and on completion close and then refresh the original page or redirect it to the edit record form. Just not sure how or if that would work.
------------------------------
Nathan Maubert
------------------------------
You could do a pop up using the following syntax:
"<a class='Vibrant Success OpenAsPopup' data-height=350 data-width=500 data-refresh=true href=\""& url here &"\" >Copy</a>"
That will open up your code page and when the user clicks to close it, either with button or just closing the window QB will refresh the current page.
You could still go with a confirmation process in the code page that says 'confirm copy' or cancel so that the copy is not immediate if they land back there mistakenly.
------------------------------
Chayce Duncan
------------------------------
- NathanMaubert2 years agoQrew Trainee
So if I am understanding you adding a confirm would be on load. however I do not want the user redirected back to the page each time only to have to click a cancel button as this certainly would be confusing. Managed to open the code page as a pop-up and refresh the original report. Might be good enough for now but can't embed this button on any forms as it does redirect incorrectly there (causes a second copy).
------------------------------
Nathan Maubert
------------------------------- ChayceDuncan2 years agoQrew Captain
The buttons would be one option, yes. It puts that choice back in the users hand to help control the experience. Some other options I thought about since the last comment:
- When you open the code page and the copy is done - have the new record open in a new tab and then use history.back on the code page to return to where they came from already, and then the new tab is the new record but doesn't have history to go back to.
- Before you create a copy - query to see if that user created a record in the last 30 seconds lets say and if so in the code page just ignore it and send them home
- When the copy is done - have the user click a button that says 'take me back' or 'take me to my new record'. If you take them back - you can use history.back to return them to the prior page so if they then hit back its not to your code page, and if you hit take me to new record, you can open the new record in the new window and then either close the window they're in or take them to the home page or something like that with that window.
------------------------------
Chayce Duncan
------------------------------