You need to sign in to do that
Don't have an account?
prechat
I'm using the following code samples to create a custom pre-chat form:
https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/snapins_web_dev/snapins_web_lightning_components_prechat_sample_aura.htm
I'm trying to figure out how to write a very simple validation function (just to prevent null fields). I have this so far:
function validateFields(fields) {
var fieldsAreValid = true;
fields.forEach(field) {
fieldsAreValid = fieldsAreValid && field.value;
}
return fieldsAreValid;
}
but have not been succsful in implementing it. Any resources/help would be very much appreciated!
Thanks,
Michael
validateFields(fields): Validate that the pre-chat fields have the necessary attributes and match what’s defined in setup. Returns an object with information about whether the pre-chat fields are valid for starting a chat, and details for any invalid fields.
https://developer.salesforce.com/docs/component-library/bundle/lightningsnapin:prechatAPI/documentation
https://rajvakati.com/2018/11/13/customize-the-pre-chat-page-ui-with-lightning-components/