Update before page loads
I have the attached page which creates a URL 'slug' from a newly created page title. It works after submitting the form. However, I'd really like it to update the field before the page submits (one less thing for the user to do) - but this obviously won't work as it is, as the form isn't created before the page loads!
I can move the 'slug' code before the update code - but how do I call it 'something' so that the update behaviour takes the value of 'something' ?