
Announcements
Hi everyone,
I'm quite new to working with power portals and can not find a solution. I believe there exists very simple code which would help me out.
I need to reset the lookup value (city) of the field when another one is changed (province) when editing or creating a new record. So far I have the below code but it just resets the lookup value, but doesn't clear it from the form and doesn't let me save the form (city is a required field), so it's a bit confusing, maybe I just left a mistake in code:
$(document).ready(function () {
$("#cr52c_province").change(resetfield);
resetfield();
});
function resetfield() {
$("#cr52c_city").attr("value",null);
$("#cr52c_cityId").attr("value",null);
$("#cr52c_city").attr("value",null);
}
Moreover, the form cannot be saved even if the province field is not modified, so every time when the form is opened in edit mode, the city needs to be selected once again in order to save the edited form.
// where "primarycontactid" is the field anme
$("#primarycontactid").val('');
$("#primarycontactid_name").val('');
// if it is a Customer lookup could optioanly also
$("#primarycontactid_entityname").val('');