Forum Discussion

Curtis_M's avatar
Curtis_M
Qrew Cadet
6 years ago

Submit Button w/o JavaScript

Hi,

I have a bit of a dilemma.
From my understanding, JS will not be supported within buttons in the near future.
How can I create a submit button for a form without using JS?

The issue I run into using the following line of code:

URLRoot() & "db/" & [_DBID_ELS_OPS_SUPPORT] & "?a=API_EditRecord&AppToken=" & $Token & "&rid=" & URLEncode ([Record ID#])& "&z=" & Rurl()
& "&_fid_113=true"
& "&_fid_114=" & Now()
;

Is that it needs a record ID# to reference. If the record has yet to be saved, then it won't have one to edit and check a box. So it tells me the record does not exist.
I have tried to redirect it to creating a fake child then redirecting back since that triggers a save, but it happens too fast and I end up with the same result.

I am hoping someone knows of another solution.

Thank you.

------------------------------
Curtis Middleton
------------------------------
  • I am close to a solution:

    I was going to create a 2nd Submit button paired with an automation.
    There is an ability to add attachments (child) which triggers the record to be saved.

    Some requests do not require an attachment but it is an option.
    I will have a summary field for how many attachments there are.
    If = 0, then I will have the 2nd submit button show, this will pretend to create a child record which will cause the parent to save, and then it will redirect them to where I want, making them feel like they directly submitted it.

    On the back-end, I will have an automation that says when a record is saved, attachments summary = 0, and the request type = x or y or z, check 'Submit Checkbox'. This will trigger my other functions to operate as should.

    The issue I discovered with this is that if they do want to add an attachment, it will trigger the 'Submit' function early since the attachments will be at 0 until they save the attachment.

    ------------------------------
    Curtis Middleton
    ------------------------------
    • Curtis_M's avatar
      Curtis_M
      Qrew Cadet
      It looks like I will need to add a field for those specific requests, that asks if they need to add attachments which will then show the 'Add Attachment' button. That way I can give the automation a way to differentiate between an attachment being added and the record being submitted.

      And this way I won't need to create a 2nd button, I can just have the functionality of the original button be reliant on specific fields and redirect accordingly.

      ------------------------------
      Curtis Middleton
      ------------------------------
      • MichaelTamoush's avatar
        MichaelTamoush
        Qrew Captain
        IF you figure something out, let me know. I just recently posted a question that is very similar to this. I need a save button on a child record to save and display (on mobile) without it jumping back to the parent. I also thought about creating a fake child as a way to save and somehow returning. If you come up with something, please post what you did!

        ------------------------------
        Mike Tamoush
        ------------------------------
  • It s unlikely that javascript will stop being supported.  It is more likely that the Realm Admin will be able to block the use of javascript in order to have a fully secured environment.

    But can you explain what you are trying to do.  Are you trying to replace the native save button?  Have to tried enabling he checkbox called "Save Parent Record Automatically when child record is added, checkbox in The Advanced Properties for the Table and then having a button to navigate away from the record?


    EDIT: Sorry, I missed the tread above.  I see that you are trying to set a checkbox.
    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • CurtisMiddleton's avatar
      CurtisMiddleton
      Qrew Trainee
      Thanks Adam,

      I would have used this solution, but we wanted to minimize the number of "ghost" records being created, and I could see this causing an issue because a lot of our users would have no idea they created a record if they decided to back out of their request.

      ------------------------------
      Curtis Middleton
      ------------------------------