Get data from HTML components for Object Script

Posted by Rollbase User on 26-Jul-2010 22:58

Is it possible that the Object Script use data from HTML components? Similar to: x["amount"] = Request.Params.Get("amount");

All Replies

Posted by Admin on 27-Jul-2010 12:46

On client side you can use any HTML components, including form controls. For instance:

document.theForm.myFiewld.value

Posted by Admin on 03-Aug-2010 03:52

From the documentation, Object script is used in the server-side, mostly with Object Script trigger.

So, the question is, how can I pass the data from my HTML component (which is in client side) to my Object Script command which is in server side?

Posted by Admin on 03-Aug-2010 15:31

Through object fields. If you don't want fields to be actually displayed, try to use Hidden Fields. Than you could use something like this:

x["amount"] = parseFloat("{!hidden_amount}");

Posted by Admin on 04-Aug-2010 01:56

I thought so...

If I am in Update page of Object A and would need to create Object B from there, I would have to create all of Object B's fields in Object A and then create Object B record through Object Script API. It seems redundant - fields of Object B are also in Object A.

Anyhow, seems that it's the only way. thanks anyways.

Posted by Admin on 04-Aug-2010 10:35

I didn't say that. Just populate a JavaScript array and supply it to createRecord() API.

However you need fields in order to extract info from HTML form and process it on server side. Without fields (of object A in your example) the server will have no idea about your data from custom HTML form.

This thread is closed