Skip to content

Use the internal framework in another projects

How to use our internaljs framework in other projects

Section titled “How to use our internaljs framework in other projects”
  • Copy internal.js in that project
  • Copy custom.js in that project
  • Call init_template() (or load_page()) on DOMContentLoaded so the framework can register inputs, dropdowns, clickables, etc.
<script src="scripts/internal.js"></script>
<script src="scripts/custom.js"></script>
<script>
document.addEventListener("DOMContentLoaded", init_template);
</script>
  • Element id must start with input_ , e.g.
<input id="input_crop_name" />
  • Add a data-validate attribute (even an empty rules array) so load_input() creates an entry in structure.inputs and input_enforceRules() keeps current_value in sync:
<input
id="input_crop_name"
data-validate='{"rules":[],"show_ok":false,"show_error":false,"valid":false}'
placeholder="Enter name"
/>
  • Once those conditions are met:
const value = inputbox("input_crop_name").getValue();
inputbox("input_crop_name").setValue("New name");