Altering the document from within a formula. - Forum - Rollbase - Progress Community

Altering the document from within a formula.

 Forum

Altering the document from within a formula.

  • Am I able to access the document form from with a formula that returns a date? a la: var date = new Date().getTime(); var box = document.getElementById({!token#id}); return date; ? please advise :)
  • prolly important to note.. we actually want to change it..
    //
    var box = document.getElementById({!token#id});
    box.checked = false;
    //
  • No, you cannot, since there is no HTML document on server side.

    I found this in Chapter 6 of documentation:

    You can use any valid JavaScript code in your formulas, including Array, for loop etc. However to protect our computational resources total execution time of any formula is limited to 2000 ms. For obvious reasons server-side formulas cannot use Document Object Model or third-party libraries. Core JavaScript objects (Math, String, Date) are available for server-side scripting.
  • thank you that helps. :)
    naturally my next query would be:

    Is there a way to reset a form after submission, via trigger formula, rollbase api call, or otherwise; that way triggers don't re-run for checkboxes that remained checked?
  • ...the next time it [the form] is submitted.
  • Triggers run every time the record is created, updated, or deleted.

    I suggest you take a look at chapters 1 and 2 of documentation to get a jump-start on Rollbase platform.
  • ok.. i think this is more along the lines of what i'm trying to do..

    Am I able to access the document object in an onLoad Page event like:

    document.theForm.reset;

    ?
    on page3 of the RB EventHandlers and AJAX API it recommends something similar.
  • Yes, you can do this. Go to your object definition and scroll down to the Pages section. Click the link called "OnLoad" next to the appropriate page -- here you can define any JavaScript to run when the page is loaded.

    Hope this helps,
    Matt