Form.js, form.yml, .erb flow?

Is there a diagram or flow for interactive applications, that shows the flow of a request? I want to confirm when the .js is loaded, and what is available to the form.yml from the javascript, as well as what data is available to the submit.yml.erb?
e.g.when clicking: https://ondemand.url/pun/sys/dashboard/batch_connect/sys/matlab/session_contexts/new

I cannot find any reference to the form.js in the documentation, only references to it in example apps or on the discourse.

Thanks

Bruce

I don’t know if there are any good tutorials, especially around javascript. But I can say that Jquery is your best ally in the form.js. That’s one of the few javascript libraries that’s available.

When you hit a /new page we bundle the javascript files up and send it in the html page that you render. So it’s executed as it’s ready.

You can try something simple like this. This function will be executed when the document is ready (that’s a native web browser event - the page being ready). We typically add all the change handlers at this point. When the document is ready you can query for elements and add change handlers to them as you see fit.

jQuery(function(){
  console.log('the page is ready');
});

Everything on the page is available to the javascript. My advise would be to interactively query in the browsers’ dev tools console to interact with jquery and the page.

Here’s a simple jquery to get the cluster form element by it’s id.

$('#batch_connect_session_context_cluster')

The data that’s available in the submit.yml.erb is everything that you’ve defined in the form (i.e., you have a node_type form element, then node_type variable is available in the submit.yml.erb).

Jeff,

Thanks for the explanation, that helps quite a bit. This also confirms that the form.js is only processed when the /new page is hit, vs. every time the form.yml is loaded.
Noted that the javascript is client-side processed so my assumption should be correct.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.