Discussions

Expand all | Collapse all

Conditional Button

  • 1.  Conditional Button

    Posted 08-08-2020 11:15
    I have a button I've created for use in my forms that saves the current record/changes and then exits to the dashboard.

    My question is, can I make this button's destination conditional in the sense that I'd like it to return to the dashboard specific to a user's role.  For example my dashboard as Admin may be different than that of a Participant.

    Here is my current button code:
    "<a style=\"width:310px; text-align: center; background-color: #0274be; color: #fff; padding: 10px; text-decoration: none; font-weight: bold; border-radius: 4px; margin-left: -50px; text-transform: uppercase; \" onclick='DoSaveAdd()' href='https://MY ADMIN DASHBOARD URL'>Save Changes & Exit</a>"
    
    
    //Saves changes and exits to the dashboard​


    Thanks in advance for any insights.

    ------------------------------
    Chris Hesenflow
    ------------------------------


  • 2.  RE: Conditional Button

    Posted 08-08-2020 11:46
    The url below will go to the home page of the app, which then be automatically how the users Role is set.  Does that work for you?

    urlroot() & "db/" & appid()


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Conditional Button

    Posted 08-08-2020 12:57
    Thanks, Mark.   And this is where I get screwed up every time with syntax.  How would I place that code into my URL?  (sorry, stupid question, I suppose). As soon as I add in the "db/" with quotations, it throws an extra characters error at me.

    urlroot() & "db/" & appid()

    "<a style=\"width:310px; text-align: center; background-color: #0274be; color: #fff; padding: 10px; text-decoration: none; font-weight: bold; border-radius: 4px; margin-left: -50px; text-transform: uppercase; \" onclick='DoSaveAdd()' href='https://MY ADMIN DASHBOARD URL'>Save Changes & Exit</a>"

    //Saves changes and exits to the dashboard​



    ------------------------------
    Chris Hesenflow
    ------------------------------



  • 4.  RE: Conditional Button

    Posted 08-08-2020 19:26
    try this

    "<a style=\"width:310px; text-align: center; background-color: #0274be; color: #fff; padding: 10px; text-decoration: none; font-weight: bold; border-radius: 4px; margin-left: -50px; text-transform: uppercase; \" onclick='DoSaveAdd()' href=" & URLRoot() & "db/" & AppID() & ">Save Changes & Exit</a>"

    //Saves changes and exits to the dashboard

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Conditional Button

    Posted 08-09-2020 08:55
    Brilliant!  Thank you so much for your help.

    ------------------------------
    Chris Hesenflow
    ------------------------------



  • 6.  RE: Conditional Button

    Posted 08-09-2020 09:40
    Chris, can you test two things for me so I can add that to my fully reliable tricks.

    Does it definitely actually save the data and not just say it saves the data.

    If there is a grid edit child record report on the parent and you save, does it also correctly save the children changes and not just say that it did.

    I had some previous code that I was using where the yellow message would come up to say that it was saving but in fact it was not saving. I just want to be sure that this code actually performs as advertised.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 7.  RE: Conditional Button

    Posted 08-09-2020 10:20
    I will take a look at this a bit later today and let you know.

    Appreciate the follow up.

    ------------------------------
    Chris Hesenflow
    ------------------------------



  • 8.  RE: Conditional Button

    Posted 08-09-2020 11:55
    In testing it out, it actually doesn't save.  It returns to the dashboard properly, but does not save any changes or edits.

    ------------------------------
    Chris Hesenflow
    ------------------------------



  • 9.  RE: Conditional Button

    Posted 08-09-2020 12:03
    OK, so that is the same problem I had and I never did solve it.

    Mark Shnier
    sent from my iPhone 8