18 Apr 2022
in reply to
Missing user
Link to this post
Hello Graham,
There are a few ways you can do this. I would recommend using get_textValue() if you think the labels of these fields won't change often. The get_value() function returns the entity logical name and the encrypted GUID separated by a semi-colon (ie. account;00000000-0000-0000-0000-000000000000) - these GUIDs change on a per user basis and would be impossible to track.
This should work for what you're trying to do:
tpc.forms[0].kau_intendedfieldofstudy.add_valueChanged(function() {
let theValue = this.get_textValue();
if(theValue === "YOUR VALUE HERE") {
// Show field 0
tpc.forms[0].kau_otherfieldofstudy0.show();
// Hide field 1
tpc.forms[0].kau_otherfieldofstudy1.hide();
} else if(theValue === "YOUR OTHER VALUE HERE") {
// Do something else
}
});
If you'd like to learn more about what you can do with The Portal Connector API take a look at these docs: https://www.crmportalconnector.com/developer-network/documentation/portal-connector-widgets/tpc-client-side-api/mvc-based/lookup
Hope that helps,
Brady
TPC Web Developer