setTimeout(function() {
var value = getFieldByName("z_prefix").getElementsByTagName("input")[0].value;
}, 10); // <-- 10ms worked in my test environment, but you may find you need to increase the duration of this timeout
I would have filed this behavior to be fixed, but it seems this has already been updated in the recently released 11.0 SP15 which is available to subscribers. In SP15, you can simply call this.value
without the timeout in order to retrieve the new value in an onChange event.
Chris