Run JS from short field + button to long field

I selected Writer as Web/HTML wasn’t an option; I did menu > File > New > HTML Document. I inserted a script which yielded a dark green anchor, and inserted in it javascript password generator - Stack Overflow I then attempted to insert a variable which I couldn’t name but inserted a grey anchor which I attempted to type in it “length” but it was the default color and I expected it to have the background the same color as the anchor (stretching the anchor). I then inserted a short field, a button & a long field, which I named before creating the next one.

I then attempted to do the equivalent of an HTML onClick that somehow got the input of the short field as an argument for the script and get the result in the long field. I was not able to do so, actually I couldn’t even access the function as can be seen in


What I have so far is the text of (as HTML is not supported, one need to take the text and create a HTML file and paste it in (then save))
Password_generator_from_hajikelist-01.odt (17.1 KB)

Thank you kindly for your help

Added macro tag, because if you want to do this password generating in a Writer document, you have to make a macro that you don’t save in the text of your document, but rather in the Macros section (Tools - Macros - Organize macros). Other people are better equipped to help you further.

My main goal is for a web browser form to trigger a script. I only want to use OO to make the page. Wouldn’t a macro force the script to be run in OO?

If you want to do it in HTML, leave LibreOffice alone. WYSIWYG HTML editors are terrible at handling scripts and also at css. You might make a quick draft with Libre, then proceed with a decent text editor that supports syntax highlighting and do the hard work there. With your browser and the editor open, save your work, open in your browser or reload the page for testing. Works way better.

Cross posted to the AOO forum.

If you cross post, please let us know that you have done so, otherwise it leads to several discussions and a waste of time because several identical answers may be posted by different users.

2 Likes