Setting data on the hidden field automatically base on the input data from text field

Hello to all expert here. Kindly give some help to some beginners like me here in ERPNEXT.

Here is the situation. I want to create a function where I want to get the code value set on the Text Field (T_FIELD) and set it automatically on Hidden Field (H_FIELD) set also and register it. How can I do this? Below is the parameters:

DocType: TestForm
Text Field: T_FIELD
Text Field Value: 000: Apple, 001: Banana (Pull Down Menu)
Hidden Field: H_FIELD

Actual target result:
When “001: Banana” is set on the Text Field (pull down menu), “001” code must be set on Hidden Field.

have he hidden field read only also, and on h_field option put doc.t_field it should work.

Please refer to:

Thanks for your reply. I appreciate it very much. But I only need not the whole value but only the code (ex: 001).

T_FIELD is a Link field?

T_FIELD is the field name of the text box where the data will be input.

So u write 001:Banana by hand or u select it from the drop down in T_FIELD? If u are using a Link Field (drop down menu), the link will help

write a “custom script”… and use split function in javascript and set the value of hidden value…