You can't get away from the two languages, as you are working with two computers that pass information to and fro. With nuBuilder, the server is using PHP and the client browser is using JavaScript. jQuery is just a JavaScript library that simplifies a lot of operations. Five lines in your original code were replaced with two jQuery lines.calida82 wrote: ↑Mon Jan 22, 2024 2:54 pm Hi, thanks again, no I don't know jquery, I'm now approaching web languages... I took a look at the first link you gave me and I saw that you can do practically everything and even with little code. the thing that annoys me a little is that in this way the two languages are merged and if you want to make some changes in the future it will perhaps be more complicated than acting on each language individually. I haven't tried to write anything yet, if I can I'll try tonight.
This is exactly correct. You should do as much as possible in the form's custom code as this only needs to run once when the form is loaded. The PHP procedure generates only the JS code that modifies the content based on the results of a query etc. This will be run whenever the procedure is called. There are various ways to use AJAX but the nuBuilder functions such as nuJavaScriptCallback() and nuAddJavaScript() let you create JS code dynamically and then run it on the client. You will soon pick it up.To avoid making mistakes between ' and " to write javascript code inside the $js variable I thought of adding all the tags I need with the right formatting in the custom code of the module by inserting only the tags or giving them a value " " and then via php with jquery as you showed me replace the spaces with the values of the query. so I have the possibility of writing more code each in its own editor which often helps to avoid errors....
All the best,
Neil