function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nitesh 22Nitesh 22 

error message on email address not updating

Hi,

We have a lightning component where end-users enter email address into a search field (field is of type email). The Aura component then has a jscript controller that submits the form on each end-user input.

So if user enters invalid email address they are supposed to be alerted immediately rather than until they press the 'search' button.

Sometimes the error message are out-of-synch with the user input - not sure where I can look at what the issue is. I output'd the user input and that is being correctly captured and passed on to the controller -> but it is the Salesforce validation error that is a bit confused.

Below are some examples:
User-added image

1. working fine - invalid email address entered and end-user is given an error message
2. after entering several incorrect email addresses, enter a correct one and the UI is showing the wrong message (see in console output that the correct user input was capture and passed onto the j/script controller
3. when entering 'aaaaaaaaaaaaaa' as email address and holding down backspace and removing all input .. user should not be presented with error message - but they are (you can see in the chrome console output that indeed it recognised empty string has been entered)

These are some of the build items
Aura Component
<lightning:recordEditForm...
    <lightning:accordionSection name="search" ..
      <lightning:inputField aura:id="Email__c" fieldName="Email__c" onchange="{!c.saveConfig}" />
Js controller
  saveConfig: function( component, event, helper ) {
        component.find( 'recordEditForm' ).submit();
    },
we have also tried as follows for JS controller:
    saveNoListConfigDelayed: function( component, event, helper ) {
        var delay = 200;
        var timer = component.get( 'v.timer' );
        clearTimeout( timer );
        timer = setTimeout( $A.getCallback( function() {
                component.find( 'recordEditForm' ).submit();
                component.set( 'v.timer', null );
            } ), delay );

        component.set( 'v.timer', timer );
    },
Any help would be very much appreciated