fliwire Posted April 7, 2021 Share Posted April 7, 2021 how to disable validation with processInput hook? Or maybe better solved this problem? Tried to load custom options and save value. $wire->addHookBefore('InputfieldSelect::render', function (HookEvent $event) { $InputfieldSelect = $event->object; if ($InputfieldSelect->name == "dselect") { $page = wire("page"); $event->replace = true; $options = [ "1" => "test2", "2" => "test3", "3" => "test4", ]; $attrs = $InputfieldSelect->getAttributes(); unset($attrs['value']); foreach ($options as $key => $value) { $selected = $key == $page->dselect ? "selected" : ""; $out .= "<option value='{$key}' $selected>{$value}</option>"; } $out = "<select " . $InputfieldSelect->getAttributesString($attrs) . ">{$out}</select>"; $event->return = $out; } }); // tried for disable validation $wire->addHookBefore('InputfieldSelect::processInput', function (HookEvent $event) { $field = $event->object; if ($field->attr('name') == "dselect") { $page = wire("page"); $event->replace = true; // $field->setAttribute('value', input("post", "dselect")); $event->arguments(0, $field); } }); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now