Populating a Text Input field issues

Hey Johnny,
Not sure if this is a bug or user error on my part…

I have a button in the form that when clicked, does a lookup of data and attempts to populated a input text field with a name.

When the button is clicked, I can see the name populate to the screen on the browser, however, when saving that form, the text in that particular field isn’t save.

But, when I actually type data into that field, it is saved as expected.

I can see when using the Inspector, that while the screen of the page has changed, the value of the form field hasn’t.

above, you click the green button, it populates the BioContribAuthor field above.

However, in Inspector, you see:


Where you see the actual value is “typed entry” and not matching what is in the browser to the user, and it is this value that is submitted back for insertion into the DB.

But, as mentioned, if I type anything in that text field, even a space, the Inspector is updated to reflect everything in that field…so it seems as if there is some sort of event trigger or something I need to use to make this work?

I did expand on the Event tag for that field in the Inspector, and got:

Hoping this is a simple user error on my part and you might be able to point it out to me?

Thanks much!

Erick

FWIW, I got this to work by doing a callbackEditField and callbackAddField to sort of get it out of GC control, and be able to id the fields as appropriate…so this was a way out of my problem, but interesting that I needed to do that to make it work.

Hello @ekrueger ,

Yes that’s the correct way to do it. The main reason that you have to use callbackEditField and callbackAddField is that if you don’t use, this is going directly with the React code which is protecting any changes for security reason. The only way to pass a value and have custom JavaScript to the fields is due to callbackAddField and callbackEditField. If there are added then JavaScript is searching for the input by name instead of checking it internally in JavaScript. React is using its own form so every update is added internally. Even if you manipulate the DOM, it won’t work.

Regards
Johnny

1 Like