Knowee
Questions
Features
Study Tools

Have a String Field (Requester Email ID) , and onchange of requester email id other details such as user name, department etc should populate.When i change the email id and place the cursor outside of the filed (just clicking on the form anywhere) the script is working before Save and values are capturing after SAVE at the backend. The Issue is i am changing the email id (curser is still inside the field) and click on Save the Onchange script is not triggering. While loading i can see the changed values but the form shows the old values after Save.

Question

Have a String Field (Requester Email ID) , and onchange of requester email id other details such as user name, department etc should populate.When i change the email id and place the cursor outside of the filed (just clicking on the form anywhere) the script is working before Save and values are capturing after SAVE at the backend. The Issue is i am changing the email id (curser is still inside the field) and click on Save the Onchange script is not triggering. While loading i can see the changed values but the form shows the old values after Save.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

It seems like you're having an issue with a form where the onChange event for an email field is not triggering when you click save while the cursor is still in the field. This could be due to the way the event listeners are set up in your code.

Here's a step-by-step guide on how you might troubleshoot and resolve this issue:

  1. Check your event listener: Make sure that your event listener is set up correctly. It should be listening for the 'change' event on the email field.

  2. Check when the event is triggered: The 'change' event is usually triggered when the element loses focus, i.e., when you click outside of the field. If you're clicking save while the cursor is still in the field, the field may not be losing focus and thus the event may not be triggering.

  3. Use 'input' event instead: If you want the event to trigger as soon as the email is typed or changed, you might want to use the 'input' event instead of the 'change' event. The 'input' event is triggered every time the user inputs data into the field.

  4. Update your save function: You may need to update your save function to manually trigger the 'change' or 'input' event before saving the form. This can ensure that the event is always triggered, regardless of whether the field has lost focus.

  5. Test your changes: After making these changes, test your form again to see if the issue is resolved. Make sure to test both scenarios - clicking outside of the field before saving and clicking save while the cursor is still in the field.

Remember, without seeing your actual code, it's hard to provide a definitive solution. These steps are just a general guide based on the information you've provided.

This problem has been solved

Similar Questions

onChange event should be attached to the input elements to make it dynamic.TrueFalse

<button id="addCustomerInput">Add input</button><div id="inputContainer"></div>            On click of this button an input tag is added with a common class of "customerInput".When the user puts in any value in these input tags the unique values are to be saved in the database table named "users_customer_inputs" by replacing the existing ones. The javaScript code to send the data of all the inputs is stated below. Will the following achieve the aforesaid objective or is there any issue with the code if so identify the issue and resolution?                                     $("#addCustomerInput").click(()=>{                                                                               $("#inputContainer").append("<input class="customerInput" type='text' placeholder='Input values'/>");                                      $(".customerInput").on('change', function() {         var customerInputs = []        $(".customerInput").each(function(){ customerInputs.push($(this).val())});                 $.ajax({            url: '/users/computationModule/',            data: {                                                                                                                     'customerInputs': JSON.stringify(customerInputs),                'operation': 'saveCustomerInputs',            },            type: "POST",            dataType: "json",            success: ()=>{                alert("Inputs successfully saved");            },            error: function () {                alert("Error");            }        });    });});    Option 1: The javaScript code stated does not have any issues and will achive the mentioned objective.Option 2: The javaScript code stated will not work as there is an issue with the syntax of the code.Resolution : Change the html string inside append method to "<input class='customerInput' type='text' placeholder='Input values'/>"Option 3: The javaScript code stated will not work as it will result in same event being set on the input tags multiple times resulting in multiple triggers of the AJAX query and consequently multiple alerts on screen. Resolution : Turn off all the existing "change" events on the customer Input class using off('change') before registering new event.Option 4: Both 2 and 3(1 Point)Option 1Option 2Option 3Option 4

Use the _____ attribute on the <form> tag to specify the name and location of the script that will process the form control values.{$a->questionintifier} Yanıta.processb.actionc.none of the aboved.method

Once the need for change has been identified, what would be the next step in the change process?Selected answer will be automatically saved. For keyboard navigation, press up/down arrow keys to select an answer.ato plan and prepare for changebto implement the changecto sustain the changedto motivate the workforce

What is the purpose of the onsubmit event in a form?To validate the form when the user focuses on itTo run a script when the form is submittedTo reset the formTo prevent form submission

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.