Altering the document from within a formula.

Posted by Rollbase User on 14-Apr-2010 16:54

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 :)

All Replies

Posted by Admin on 14-Apr-2010 16:55

prolly important to note.. we actually want to change it..
//
var box = document.getElementById({!token#id});
box.checked = false;
//

Posted by Admin on 14-Apr-2010 17:17

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.

Posted by Admin on 14-Apr-2010 17:58

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?

Posted by Admin on 14-Apr-2010 18:00

...the next time it [the form] is submitted.

Posted by Admin on 14-Apr-2010 18:09

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.

Posted by Admin on 14-Apr-2010 21:38

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.

Posted by Admin on 26-Apr-2010 13:00

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

This thread is closed