Editing input in form field

I have a form with this input field. If I type text in that field and then change that text to something else. getItemValue still shows the old text.

{ type: "input", label: "Title", name: "title", },

var title_text = add_event_form_.getItemValue("title");

First I type “Global Form” in the input field. Then I edit the input to be “External Form”. The variable title_text returns “Global Form”.

Hi
Please attach demo with issue

Hello, I have the same problem.

Example :
searchInput default value is null

Here is my code :

myForm.getInput('searchInput').onchange = function() { alert(myForm.getItemValue("searchInput")); };

When I edit my input field, I put “test” for example, The alert box says “null” and not “test”…

Why ?

Thanks for your help :slight_smile:

Sorry, I’ve just found the solution.

I simply replaced :

myForm.getItemValue("searchInput");

by

myForm.getInput("searchInput").value;

The question is : What’s the difference between this two codes ?

The 1st one do works when used with an onClick event but doesn’t seem to work with onChange event.

Hi

inside each item value stored not directly in input box. this need for null-values and canceling in “onBeforeChange”, change triggered from “onblur”, and click not trigger blur.

blur -> input.value stored -> onchange triggered -> getItemValue() returns correct value

onclick not trigger blur, so getItemValue() returns old value