Forum Discussion

Kelly-AnnTainto's avatar
Kelly-AnnTainto
Qrew Trainee
20 days ago

Nested API Button open form to add input, check box and redirect back to original form

I have another API Button question...similar to my last question.   Using the same table set up (below), but this time the button would be selected if it's for a license that would not be applicable and input from the User would be required.   I created a simple table that would pop up when the button was pushed asking the User to add information into the field. It would also check the [Not Applicable] button, then refresh back to the original page.   However, I get the attached error page.   Any thoughts?  

License Master (parent table)

Pending Locations (parent table

Suggested Licenses (a child (many to many table) to both above)

Licenses (child (many to many table) to both License Master and Pending Locations / unrelated to Suggested Licenses)

var text UpdateSuggestedLicense=URLRoot() & "db/" & [_DBID_SUGGESTED_LICENSES]
& "?act=API_EditRecord"
& "&rid=" & URLEncode([Record ID#])
& "&_fid_18=true" //Check Not Applicable to this Location
& "&apptoken=MY TOKEN"
& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid()
& "?a=dr&rid=" & [Record ID#]); 

var text OPEN="<a class=\"OpenAsPopup\" data-height=900 data-width=900 href='" 
    & Dbid()
    & "?a=API_EditRecord&rid=" & [Record ID#] // Suggested License ID
    & "&dfid=11" // Not Applicable form ID
    & "&apptoken=MY TOKEN";

var text RefreshPage = URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();//refresh and redirect back to License page

$OPEN
&"&rdr=" & URLEncode($UpdateSuggestedLicense)
& URLEncode("&rdr=" & URLEncode($RefreshPage))

  • I think that you are saying that this button has nothing to do with three of your four tables.   You just want a button to put the record you are sitting on into edit mode on form ID#11, and then you will require the user to input into a field and if they do and save,  then a checkbox will get checked and the user will be landed to display the record.

    var text OpenInEditMode = URLRoot() & "db/" & dbid() &  "?a=er&rid=" & [Record ID#] // Suggested License ID
        & "&dfid=11"; // Not Applicable form ID

    var text UpdateSuggestedLicense=URLRoot() & "db/" & dbid()
    & "?act=API_EditRecord"
    & "&rid=" & URLEncode([Record ID#])
    & "&_fid_18=true" //Check Not Applicable to this Location
    & "&apptoken=MY TOKEN";

    var text DisplayOnRegularForm = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]); 

    $OpenInEditMode

    & "&NextURL=" & URLEncode($UpdateSuggestedLicense)
    & URLEncode("&rdr=" & URLEncode($DisplayOnRegularForm))

  • I think that you are saying that this button has nothing to do with three of your four tables.   You just want a button to put the record you are sitting on into edit mode on form ID#11, and then you will require the user to input into a field and if they do and save,  then a checkbox will get checked and the user will be landed to display the record.

    var text OpenInEditMode = URLRoot() & "db/" & dbid() &  "?a=er&rid=" & [Record ID#] // Suggested License ID
        & "&dfid=11"; // Not Applicable form ID

    var text UpdateSuggestedLicense=URLRoot() & "db/" & dbid()
    & "?act=API_EditRecord"
    & "&rid=" & URLEncode([Record ID#])
    & "&_fid_18=true" //Check Not Applicable to this Location
    & "&apptoken=MY TOKEN";

    var text DisplayOnRegularForm = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]); 

    $OpenInEditMode

    & "&NextURL=" & URLEncode($UpdateSuggestedLicense)
    & URLEncode("&rdr=" & URLEncode($DisplayOnRegularForm))

  • Thank you, Mark!   I added back in the var text RefreshPage rather than the var text DisplayOnRegularForm as I need the User to return to the original form they were on which was on a different table.   The only remaining question I have is it possible to make the form open as a pop up window rather than a full page?   If not, then what you provided works.   Thanks again. 

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      The problem with a pop-up is that once you save the record, I don't know of a way to close the pop-up box without using some kind of fancy code page.