Forum Discussion

KimG's avatar
KimG
Qrew Cadet
4 years ago

Smarter button which checks certain info, then reacts accordingly

Hi

I have a button in QB for users to click to verify that certain information listed in a particular record is correct.  If clicked, it checks a box that info has been verified.  (It also records the user and date this action happens).  Pretty simple.

That code looks about like this:

URLRoot() &"DB/"& Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=XXXX_fid_92=TRUE" & "&apptoken=XXXX_fid_43=" & (Today()) & "&rdr=" & URLEncode(URLRoot() & "db/" &[_DBID_QUOTES] &"?a=dr&rid=" &[Record ID#])

Once the data has been verified, next steps can happen.

This works great... except that my users keep verifying data that is incomplete. 

I need to be able to send a warning that this record cannot be verified since XZY info is missing so they will actually enter the missing data as they should.

I can't just make the fields required because some of the information isn't known when the record is created, but will later be established and is necessary before further steps happen.

How can I add that criteria to my button?  It would need to cover a few different cases, along the lines of (I know this isn't the correct syntax, but is more the general idea of what I'd like to accomplish)

If [Equipment Quoted] contains "ABC" and [ABC model number] is blank, then display message "Model number must be filled in before the configuration can be verified", ... {additional cases listed here; note that [Equipment Quoted] is a multi-select field which pulls in related additional fields}... else, {execute existing button function to verify the config} 

Or is there some other better/easier way you might suggest going about this? 

My other thought is to somehow use a form rule to hide the "verify config" button unless all these conditions are met, but that too seems complicated. I already have a form rule to hide the "verify config" button once it has already been verified.

Right now it seems they just wantonly click the button so they can execute the next steps, which will work, but then end up putting incomplete data in the system.  

Thanks for any suggestions!


------------------------------
Kim Gardner
------------------------------
  • np, here is what I suggest.

    make a field called [Warnings]

    var text Warnings = 
    List( "<br>",
    If( begins($email," "), "Leading space character" ),
    If( ends ($email," "), "Trailing space character" ),
    If( not Contains($email,"@"), "Missing @ symbol" ),
    If( not Contains(Part($email, 2, "@" ),"."), "Missing .com or similar at the end" ),
    If( Contains($email, " "), "Has a space inside the email address" ),
    //If(Part($email, 1,"<>[]{},")<>"", "Bad characters in in the email address"),
    If(Part($email, 2,"<>[]{},")<>"", "Bad characters in in the email address"),
    If(Begins($email,"<"), "Bad characters in email address"),
    If(Ends($email,">"), "Bad characters in email address"),
    If(Contains($email, "mailto"), "Bad email address"),
    If(Contains($email, ":"), "Bad email address" ),
    If(Ends($email, "."), "email ends in a period - that can't be right" ),
    If(contains($email, ")"), "email contains a bracket ( or ) - that can't be right" )

    ));

    If($Warning<>"", "<font color=red>" & $Warning)



    The for your button you do this

    var text Button = 
    URLRoot() &"DB/"& Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=XXXX_fid_92=TRUE" & "&apptoken=XXXX_fid_43=" & (Today()) & "&rdr=" & URLEncode(URLRoot() & "db/" &[_DBID_QUOTES] &"?a=dr&rid=" &[Record ID#]);

    If([Warnings]="", $Button)


      The effect of this is that you will have a warning field that you can put on reports and forms and also if there are warnings that will make the button go blank and your users will have nothing to click on.


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • KimG's avatar
      KimG
      Qrew Cadet
      Thanks Mark!  I will give that a try.  I think I could use that concept in a few other places as well. I appreciate the new ideas and sample code.

      ------------------------------
      Kim Gardner
      ------------------------------