C5, Perl and populating form fields dynamically

Permalink
I have a goal to run a perl script that will gather data to be used to populate form fields; essentially, to help users to transfer their accounts from one site to another more readily.

Presently, the perl portion returns various arrays (via the terminal window, I now need to implement it into a C5 website) for specific C5 custom attribute forms. It can just as easily be JSON - as I'm still debating whether to display the form values by using jQuery or a page refresh.
+ I suppose that using php to build the forms (which the layout varies based on the content retrieved by the perl script) I would run the perl code, then call the page again and populate it with a php array of info(?).
+ If I use JSON then I could use jQuery's functions to build and populate the form fields dynamically - which I am leaning towards doing.

I would greatly appreciate some thoughts on how best to implement the above within C5:

Presently:
If values for the user exist, I have the custom attribute displaying whatever contents are in the attribute database for that user (by unserializing the array and looping through the form). If none, then they have a button that will launch the perl script (by way of calling a c5 tools file) which would display it in the same manner and give them the option to save it after review.

Can you advise:
Go the php, page refresh route or the javascript route (or another)? I have taken the obvious precautions about form input though these users and the information from which the data is coming from is non-volatile and cooperative; however, they do not want to invest in my "cooperative" idea (via an API) unless it proves a success. Security is still a concern, but so too is the approach that would seem less likely to cause errors, instability and excessive time to implement.

Thanks

Ricalsin
 
Ricalsin replied on at Permalink Reply
Ricalsin
...so.... the js approach would entail waiting for the perl to complete and then loop the data and print the html form into a div within the attribute's form.php. Does that seem reasonable to anyone?

...otherwise... to build the form off the perl collection would seem to entail a write to an external file, then open and read it on a page load.

Does anyone have any experience or thought on doing something like this?
Ricalsin replied on at Permalink Reply
Ricalsin
I went with a reworking of the (nicely done) C5 Advanced Search javascript - like what you see occurring in the dashboard/users page.

(In C5 5.5.1) Beautify the core js/ccm.app.js file and look at how the ccm_setupAdvancedSearch function (which is called in the controller/dashboard/users header) works. With that understanding you can "setup" your own "advanced search" - and with the properly named div#id's wrapping your code - you can simply rewrite that container. In my case, I used this approach to write dynamically built forms with the values that were collected by the Perl script.