Add function to set and get values and text of fields detecting automatically the field types