
Drupal 9 coder for a callback function
- or -
Post a project like this1640
€13(approx. $15)
- Posted:
- Proposals: 5
- Remote
- #3321994
- Awarded
Description
Experience Level: Entry
It's simple, but I don't find it myself. I have a quit complex form. There are visible, checked, required states. When a use select a field, he have acces to a new select field. This select field is build with taxonomy entity reference. When the user add values to this field, and then change his mind and uncheck the first field. The values are still stored in the form_state.
I have a hook_form_alter, where I put the logic if the field is unchecked, then the values from the other field need to be unset. This need to happen in an ajax callback.
I have all the code, just need to be adjusted. Pls if you are not an expert, spare your and my time.
if ($form_state->getValue('field_a') === 0 ) {
$form_state->unsetValue('field_b');
}
I have a hook_form_alter, where I put the logic if the field is unchecked, then the values from the other field need to be unset. This need to happen in an ajax callback.
I have all the code, just need to be adjusted. Pls if you are not an expert, spare your and my time.
if ($form_state->getValue('field_a') === 0 ) {
$form_state->unsetValue('field_b');
}
Belba Trading International
99% (32)Projects Completed
28
Freelancers worked with
23
Projects awarded
42%
Last project
28 Jul 2025
Belgium
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies