What is the URL to edit a field, redirect to app homepage, and then display a pop-up message all with one button?

  • 0
  • 1
  • Question
  • Updated 10 months ago
  • Answered
I already have the URL to edit the field and redirect to the app home page. That was easy and it works perfectly. I just need the extra part to also display a pop-up message.

The URL thus far is as follows:
var bool checkedstate = If([Request Access Modification Field for Notification], false,true);

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord"& "&rid="& [Project ID#]& "&_fid_430="& $checkedstate & "&rdr=" & URLEncode(URLRoot() & "db/bgafau47s")


Separately, I got the following javascript to work on its own in a URL button:
"javascript: alert ('Your Request Has Been Sent. ')"


How do I combine the two elements into one button?
Thanks
Photo of Robin CC

Robin CC

  • 200 Points 100 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
I have never been able to combine redirects with JavaScript. I suspect you would need to do it all in java script, but let's see if anyone answers.

If you just want want the edit and a pop up message, I can do that.
Photo of Robin CC

Robin CC

  • 200 Points 100 badge 2x thumb
I'm fine with just an edit and a pop-up message.  I was under the impression that a redirect of sorts was always required with URL's like this, but if that is not the case, then yes, I would like to see the edit and pop-up.  Thanks
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Here is my current best version. This one is setting a checkbox to be checked.

var text URL = URLRoot() & "db/" & "?act=API_EditRecord&_fid_80=1&rid=" &
[Record ID#];
 
"ja ascript:" &
"$.get('" &  
$url &  
"',function(){" &
"$.jGrowl('This Item has been put on PO CANCEL snooze', {life: 5000, theme:
'jGrowl-green'});" &
"});" &
" oid(0);"

The 5000 means 5 seconds until it fades away. I like this version as it the same green color as the native QuickBase pop ups.

Note that when you do these kind of pop ups, the pop-up will show a success message even if the URL formula completely fails. So it's up to you to be sure that there is no possible way that the URL formula will fail.
Photo of Sumedha Weerasuriya

Sumedha Weerasuriya

  • 376 Points 250 badge 2x thumb
 im getting this syntax error.... 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
make this change to this part.


var text URL=URLRoot() & "db/" &  Dbid() & "?act=API_EditRecord&rid=" & [Entry Number]
& "&_fid_24=" & $NewToggle 
& "&apptoken=nqmvb72ddvit6atbe5cfycdst";
Photo of Sumedha Weerasuriya

Sumedha Weerasuriya

  • 376 Points 250 badge 2x thumb
YES! Its working! Thank you so much for your help! People will really like this new feature! 
Photo of Sumedha Weerasuriya

Sumedha Weerasuriya

  • 376 Points 250 badge 2x thumb
Helllo, 
One of my application brought this to my attention about the button we setup. I have this button on the form. When the button is clicked and a user try to save and close. He/she gets this message.  Do you know if there is a way for me to solve this? 

Best 
Sumedha 
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
I think that you should post this as a new question.
Photo of Robin CC

Robin CC

  • 200 Points 100 badge 2x thumb
Got it.  It works great.  Thanks again.  Actually, I really like that the page does not reload every time I click the button. This lets me click the button for multiple records really fast, and the edits are then still happening in the background even though I can't see it.  Of course, to then see the edits, I would have to reload the page, but this way I can reload the page just one time not each time.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Yes, I totally agree. Sometimes you do want the page refresh but at other times it just slows down the process way too much so it's great to have that tool in your toolkit of quick base tricks.
Photo of Ryan

Ryan

  • 60 Points
Hey Mark, would it be possible to have this notification popup while still having the page reload? I have a case where I need the page to reload because certain fields will be shown after the button is clicked, however I think the popup is a good indicator to have in there as well.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Sorry, I don't know how to both refresh and pop up.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,064 Points 20k badge 2x thumb
>I have never been able to combine redirects with JavaScript
>I don't know how to both refresh and pop up.
>Sometimes you do want the page refresh but at other times it just slows down the process

Why not just do it in JavaScript all the time and free your mind from the vagaries of all these special cases and the special handling they require?