Forum OpenACS Development: Re: Forms X matrix input structure

Collapse
Posted by Ryan Gallimore on
Build your datasource in Tcl as usual, then output the results to your ADP as Javascript.

To send data from your form to the db (without refreshing), execute an AJAX request with your favourite library to a Tcl file that saves the data to the db.

Don't use "onChange", instead use an Event Listener (google addEventListener).

Hope that helps.

Collapse
Posted by Iuri Sampaio on
Ryan and Dave,
Thank you guys for the feedback.
It helped a lot. I don't know how but it works! (sharing and writting about difficulties surprisingly open the mind. It makes you to look outsite the box.

It turned out I wrote the datasource on TCL and a json structure to move the data here and there, between the javascript and TCL structures.

I saw openacs lacks json interfaces. Its API is very poor. Isn't?

Am I correct?

Collapse
Posted by Torben Brosten on
Iuri,

You might be interested in the qf_ form API. It's made for scenarios like the one you have, with multiple arrays, dynamically declared forms and fields etc:

https://openacs.org/forums/message-view?message_id=3602056

It doesn't include javascript, but it's easily added.

cheers,

Torben