Forum Discussion

GiuseppeMacri's avatar
GiuseppeMacri
Qrew Captain
6 years ago

Save Button with URL Redirect and Warnings

Hi,

I have a form which has a bunch of required fields.

I'd like to create a save button which will redirect the end user to a specific web page that is different from their default page. 

If the end user is missing any of these required fields, I would like this button to indicate which field is missing, similiar to QB's native green save buttons. 

In testing (code below), i found that the redirect still occurs but the saving does not when a tester saves a form with a missing required field.

Any thoughts?

var text SAVE = "onclick=\"$('#saveButton').click()";
var text REDIRECT = URLRoot() & "db/" & Dbid() & "?a=dbpage&pageID=9";

"<a class='Vibrant Success' & " & $SAVE & "; window.location.href=' "& $REDIRECT &" '\">Submit your request</a>"

------------------------------
GMacri
------------------------------
  • So this code will do what im tryna ask:

    var text SAVE = "onclick=\"$('#saveButton').click()";
    var text REDIRECT = URLRoot() & "db/" & Dbid() & "?a=dbpage&pageID=9";

    If([Missed Data]="", "<a class='Vibrant Success' & " & $SAVE & "; window.location.href=' "& $REDIRECT &" '\">Submit your request</a>","<a class='Vibrant Success' & " & $SAVE & "\">Submit your request</a>")

    So i have a Field detect missing data in the field, i think made an if statement so that the form knows to treat the save button as just a save button if data is missing (which triggers the QB missing data warnings) and will turn on a redirect once all required data fields are filled in with something. 

    I did need to use a checkbox field as one of my data entry checks, as there is no current way to get QB to recognize whether or not a field has a "Pending" File attachment field filled which impacts how the form interprets the errors.

    ------------------------------
    GMacri
    ------------------------------