I am trying to hide entity id from my autocomplete fields. I downloaded a jquery script that removes the bracketed id and updates the autocomplete element with the new element. It then writes the entire value to the element's data like this
$(event.target).data('real-value','6');
I even updated this to use attr instead of data, I cant read this information from my Drupal form_state.
I set a data attribute on my autocomplete element using jquery like this
$(event.target).attr('real-value','6');
How do I get this value from my $formstate or $form object in my form submit function? Using dpm($form['elementname'])
doesn't even show this atrribute.
I've tried $formstate->getValue()
. Doesn't work?
Here's the script I'm using...
Just wondering why does the jquery successfully change the value of the autocomplete textbox, but cant change an attribute on the same element?
'#attributes => ['test']
and then tried changing attribute value in jquery. But formstate still returns 'test' as the value.data-
. developer.mozilla.org/en-US/docs/Learn/HTML/Howto/…