Need javascipt call to get the value of field ‘FK_country_id’
I will be tying this to a onClick event on a button on top of the form to pre-fill a readonly field (the primary key field ‘region_id’).
This field is a select lookup value to the key field in a related innoDB table within the same database (select look up with primary key being field NOT shown - instead displays country name - I need the key value.)
Obviously the insert record will produce a pre-filled select with the starting record of the related database shown first - this functionality is working perfectly, however I am unable to grab the value.
I am concatenating the country ID (a foreign key) with the region name to make a new key field in the database related to the form shown. I am doing this after validating (region_name !== empty.
Have tried:
var region_name = document.getElementById(“id_sc_field_region_name”).value;
var country_id = document.getElementById(“id_sc_field_FK_country_id”).value;
var region_new = country_id + “-” + region_name;
alert (region_nw);
Will not produce alert.
Have tried with only region_name (a text field) - Alert is produced.