Discussions

Expand all | Collapse all

Submit Button w/o JavaScript

  • 1.  Submit Button w/o JavaScript

    Posted 02-28-2020 12:31
    Edited by Curtis Middleton 02-28-2020 13:34
    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
    ------------------------------


  • 2.  RE: Submit Button w/o JavaScript

    Posted 02-28-2020 13:39
    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
    ------------------------------



  • 3.  RE: Submit Button w/o JavaScript

    Posted 02-28-2020 13:53
    Edited by Curtis Middleton 02-28-2020 13:58
    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
    ------------------------------



  • 4.  RE: Submit Button w/o JavaScript

    Posted 02-28-2020 15:08
    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
    ------------------------------



  • 5.  RE: Submit Button w/o JavaScript

    Posted 02-28-2020 15:09
    If you just need to create a new record and have it already be saved (ie already have a record ID), Kirk Trachy has code and a sneaky way to make that happen. I can show you where that is. My issue is I need that to happen and also have the parent record ID go along with it...so his code does not work for me.

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 6.  RE: Submit Button w/o JavaScript

    Posted 02-28-2020 17:30
    Mike,

    If you look above, I posted my solution. If you have questions about it, feel free to let me know and I can provide clarification.

    Regards.

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



  • 7.  RE: Submit Button w/o JavaScript

    Posted 02-29-2020 19:01
    Edited by Mark Shnier (YQC) 02-29-2020 19:03
    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
    ------------------------------



  • 8.  RE: Submit Button w/o JavaScript

    Posted 29 days ago
    @Curtis Middleton, here is a post that shows how to use API AddRecord to create a new record with an existing Record ID#:

    New Record with Record ID# ​

    ------------------------------
    Adam Keever
    ------------------------------



  • 9.  RE: Submit Button w/o JavaScript

    Posted 25 days ago
    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
    ------------------------------