Magic Button - add record but remain in form in edit mode

  • 0
  • 1
  • Question
  • Updated 4 weeks ago
  • Answered
Hello. I have a form in which I've placed a magic button. While editing the form (i.e. in edit mode), I want a user to be able to click that button (which creates a record in a separate, non-child table) without navigating away from the form or saving the form or refreshing the form, i.e. basically I want the action to execute without doing anything to the form.

Note: I'm aware of the table setting to have the parent record automatically save when a child record is created. I'm not talking about that. Ideally, nothing would happen to the form when the button is clicked. Is that possible?

Thanks!
Photo of Patrick Dunn

Patrick Dunn

  • 480 Points 250 badge 2x thumb

Posted 1 month ago

  • 0
  • 1
//I tested this and it worked

var text URL = URLRoot() & "db/" &  .... insert your add record URL here;

"javascript:" &
"$.get('" & 
$url & 
"',function(){" &
"$.jGrowl('Record created in separate non-child table', {life: 5000, theme: 'jGrowl-green'});" &
"});" &
"void(0);"


// the 5000 mean display the quiet pop up for 5 seconds.
// and you get to control the pop up words.
Photo of Patrick Dunn

Patrick Dunn

  • 480 Points 250 badge 2x thumb
Thanks, Mark. I believe I've replicated the code, but I find that when I'm in edit mode, and I click on the magic button, the form still tries to save. For instance, if a form rule indicates that field 123 must not be blank and I click the magic button, I get a form message that the record is not saved because field 123 is blank. 

Ideally, I want the code within the button to execute without triggering any kind of action (e.g. save) in the form itself. 

Am I missing something? Thanks!
Photo of Patrick Dunn

Patrick Dunn

  • 480 Points 250 badge 2x thumb
Never mind. I think the trick was that within the magic button field settings I hadn't checked the box to open in a new window. Thanks!
Ok, thx for letting me know.