do you want it auto generated or do you want to validate the users input?
for auto gen:
create the password
set do***ent.formname.fieldname.value = password
for validate
add onsubmit="return validate()" attribute to your form
add javascript function
function validate {
check value here using do***ent.formname.fieldname.value
return true if valid
return false if invalid
}