Forum Discussion

AndreonnaGarret's avatar
AndreonnaGarret
Qrew Assistant Captain
8 years ago

URL button that checks a box and prompts to fill in another field

I need to be able to have a formula button that will make some updates from a report page. The button will be used to decline a record. So the user will click it to decline, and then I would like a prompt of sorts that will have them enter a note. I don't want it to leave the report page. Simply check a box (which will be hidden) and then prompt for a note. 

I have the code to check the box as of now. I just need an adjustment to get the prompt to enter a note. Here is what I have so far.



var text url =

If([ED Fix]=false,
  URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=cp2kg3vbugcf22bd656gmp4udhs" &
    "&_fid_48=true");

If([ED Fix]=false,
"<a class=\"Vibrant Danger\" href=\"javascript:" & "$.get('" & $url &
    "', function(){" & "location.reload();" & "});" &
    "void(0);\">Incorrect</a>"
)




Any suggestions? Thanks!
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    Are your notes a child record of the main 'record' that is declined, or will the note be in a text field on that record?

    Either way you can have the RDR of the code be to open a pop-up window, that just has a spot for the note, and a save button.  

    So when the button to save is clicked, it closes the pop-up window, and you continue down the report.
    (You can add a refresh if needed too)
    • AndreonnaGarret's avatar
      AndreonnaGarret
      Qrew Assistant Captain
      Matthew, 

      It is a text field on the record. 

      What you describe sounds exactly like what I am looking for. 
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    I'll do my best to describe this one.

    You will need to make a Formula URL field with the following formula.

    "javascript:var a=window.open(\""&[Master URL]&"\", \"newwindow\",\"width=600,height=500\"); setInterval(function() {if (a.closed) {window.location.reload();}},500);"

    This will open the [Master URL] that you define in a new small window, and when the window is closed it will refresh the original page.

    So you will want your [Master URL] to have the API_EditRecord function and the rdr that will be used in the pop-up.
    • MCFNeil's avatar
      MCFNeil
      Qrew Captain
      I'd recommend that for the RDR you have it go to a simplified form where it only has the needed field you are looking for. 

      You can copy the original form, and strip out the unneeded fields.
    • AndreonnaGarret's avatar
      AndreonnaGarret
      Qrew Assistant Captain
      So what code is supposed to be in the [Master URL] field? This would be an additional field. Additionally, which URL am I using? Would I create the new form with that single field on it and then pull the URL from the preview form screen?