Forum Discussion

LandonSmallwood's avatar
LandonSmallwood
Qrew Member
4 months ago

Save and New Button creation

I am attempting to streamline (by removing manual actions) our part tracking process for newly machined parts and am looking for a way to add a "Save and New" button to the body of the form that preforms the same way as the built in Save and New button.

Each part after machining is etched with a QR code that contains the relevant data for the part.  Current setup below allows the user to click in the Part 3D Scan box, scan the QR code on the part at which time the data inputted and parsed into the correct boxes then it auto tabs to the Save and New button and pushes enter.

My issue lies with the functionality of the button.  Using the code I found in this forum I can "Save and Edit" however I can not figure out how to modify the code in order for it to open a new record for entry.

var text url = URLRoot() & "db/" & Dbid() & "?a=er&rid=%%rid%%";

var text link = "<a href='" & $url & "' data-replaceRid='true' style='font-size: 11pt;margin-left: 5px; margin-top: 0px; height: 33px; width: 160px; text-align:center;background-color:#13294d;color:white;background-image: linear-gradient(to bottom, #13294d 0%, #13294d 100%);' class='SaveBeforeNavigating Vibrant'>Save and New</a>";

$link

Any suggestions would be appreciated.

  • It's possible that you are overthinking this.  The record should autosave if you navigate away from the record.

    What if you try changing the URL to 

    var text url = URLRoot() & "db/" & Dbid() & "?a=API_GenAddRecordForm;

  • You are correct, that works.  Thank you.

    Now if I can find a way to get the focus on the page or curser in the box I can eliminate my last click.

    Thanks again

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      If you are using a Bar Code scanner, sometimes they can be programmed to insert a Tab after the QR code, that will let you tab into the button, or if you were really lucky a Tab and an Enter. .