Forum Replies Created
-
AuthorPosts
-
Ruth Hutchins
ParticipantHey - That would probably work but wouldn't be a good UX for the users!
What I ended up doing was leaving the field with disabled=true and adding a hidden input with the current value:
`
... {
add_filter( 'rwmb_status_end_html', array( $this, 'add_status_hidden_input' ), 10, 3 );
}
...
public function add_status_hidden_input( string $html, mixed $field, mixed $value ) {
$html .= '<input type="hidden" name="status" value="' . esc_attr( $value ) . '">';
return $html;
}
`Is there a reference for the allowed keys in $field[]? I think $field['id'] would work instead of hard coding the field name? $field['name'] is the label, right?
Ruth Hutchins
ParticipantHi wanted to check if there is an update on this?
I have a select field which I do not want to be changed directly from the admin interface. But I do want the value to be visible.
I set disabled = true as a custom attribute, which partially works, in the sense that the select box becomes visible but grayed out/can't be changed.
However, then if I update anything else and submit, the select field is cleared. I do not want it to go back to a default value. I want it to keep its current value. What's the best way to do this?
Ruth Hutchins
ParticipantYes please +1
I found this blog post about it:
https://metabox.io/add-custom-field-to-quick-edit/Though, since I am using the MB Admin Columns ext also I think I would have to modify that part of the jquery
-
AuthorPosts