Hidden field with dependent content

I am looking to add a hidden field the values of which depend on another field. Basically once a user choose a model I need to pass the Model Code on the basis of this. help please. Thank you

You could add some js code to fill the hidden field or why not just sending the same value itself in the POST request?