Issue with textBox in Velo - unable to save

If a TextBox is filled from a database or a variable when the page is loaded, the command:

let myValue = $w("#myElement").value;

does not see the input and just returns a blank unless a user has subsequently edited the TextBox. The same problem does not arise on TextInputs - this seems to be a problem that has developed over the past year as I have pages that used to work that no longer do so.

Please look at the example at: https://www.northnorfolkstudios.co.uk/textbox-save

Product:
Wix Editor

What are you trying to achieve:
I have put an example with the code up at https://www.northnorfolkstudios.co.uk/textbox-save

What have you already tried:
Checked the forums, talked to the Wix AI and left a message for an expert to get back to me.

Additional information:
The example page that I have put up is a very much simplified version of what I am doing. It does highlight the problem though i.e. that the ‘get’ function is flakey when used on TextBoxes.

Hi, @user588 !!

I’m not entirely sure about the situation, but are you using dataset.onReady() for now? :upside_down_face:

$w.onReady(function () {
    $w("#myDataset").onReady(() => {
        let textBoxValue = $w("#myElement").value;
        console.log(textBoxValue);
    });
});

Yes, the problem you are facing is legitimate, and here’s the solution:

No, I am not using a dataset in the example in the link. Thank you for looking

Hi Pratham,
I really appreciate your input. Unfortunately it doesn’t resolve the problem for me. I have tried the $w(‘#input2’).focus() approach both before and after I assign the vaue to the field and it still isn’t seen. I have put an invisible button just above the right-hand column - if you click on that you will see my attempt to implement your solution. I have even added some console.logs. Cheers, Nick

Your logic approach is incorrect.

You cannot save a value by assigning it to the input value.

You have to setFieldValues via code directly to the dataset.

Hi Codequeen, The thing about my example at https://www.northnorfolkstudios.co.uk/textbox-save is that it doesn’t use a dataset - it is purely illustrative of the problem and shows the difference between the way that textInput and textBox are now working - and in my actual page (of which this is a very simplified example) I am entering data into a repeater (for it to be altered and saved if need be) using wixData not wixDataset.