Forum Replies Created
-
AuthorPosts
-
November 4, 2019 at 9:13 AM in reply to: Thumbnail field in frontend form allows any file type #16781
Anh Tran
KeymasterPlease don't put any text inside the
setCustomValidityfunction. The content will be output inside quotes via PHP, so it might break the code. Instead of that, please try to add a custom JS to the page (enqueuing a JS file that contains a setCustomValidity() function).Anh Tran
KeymasterI think there are 2 issues here:
- Read-only attribute, and
- Validation for user input
A Boolean attribute which, if present, indicates that the user should not be able to edit the value of the input.
The difference betweendisabledandreadonlyis thatread-onlycontrols can still function, whereasdisabledcontrols are not submitted with the form and generally do not function as controls until they are enabled.So, it's better to prevent user to change value from a read-only date picker (the 1st issue).
The validation issue is quite different and I think can be solved with @brandonjp's solution with
patternattribute.Another issue with
readonlyis that it will ignore therequiredattribute (ref in the MDN docs above), which sometimes is a problem.Anh Tran
KeymasterHi Remy, would you please give us some feedback on the features you need? Perhaps we can help (or better understand your needs).
November 1, 2019 at 10:12 AM in reply to: ✅Warning on metabox for relationship to multiple CPTs #16764Anh Tran
KeymasterHi Aart Jan,
Is there a technical/design reason not to support it this way?
Yes, it's designed to work for single post type at the moment. Making it works for multiple post types at once is not supported at the moment, due to a lot of technical problems.
Anh Tran
KeymasterI've fixed it in MB Builder 3.2.2. The new version of AIO will come tomorrow.
Anh Tran
KeymasterHi Manoj,
The reset functionality is not built-in. You can add the following code into your theme's
functions.phpfile to add the reset button:add_action( 'mb_settings_page_submit_buttons', function() { submit_button( 'Reset', 'secondary', 'reset', false ); ?> <script> jQuery( function( $ ) { $( '#reset' ).on( 'click', function( e ) { e.preventDefault(); $( 'input[type="text"]' ).val( '' ); // Clear input values $( 'input[type="radio"],input[type="checkbox"]' ).prop( 'checked', false ); // Uncheck radio, checkbox } ); } ); </script> <?php } );The JS code is very basic and is just an idea how it works for basic fields. You might need to adjust it to make it work for other fields.
Anh Tran
KeymasterHi Alex,
I found a bug and fixed it on your site. Please try again. The fix will be added to Meta Box plugin in the next version.
Anh Tran
KeymasterHi Alex,
I got the access details. And I found that you haven't installed the MB Group extension. I installed it for you and it works.
Anh Tran
KeymasterHi Alex,
The
taxonomyfield doesn't save value. Please usetaxonomy_advancedinstead.October 31, 2019 at 11:59 AM in reply to: Thumbnail field in frontend form allows any file type #16750Anh Tran
KeymasterIt's the default browser behavior. I found an answer for that here. Please try this:
add_filter( 'rwmb_frontend_post_thumbnail', function( $field ) { $field['attributes'] = [ 'accept' => 'image/*', 'oninvalid' => 'setCustomValidity()', ]; } );And write a custom JS function
setCustomValidityto handle the invalidity.Anh Tran
KeymasterOctober 30, 2019 at 10:13 AM in reply to: ✅PHP Fatal Error after updating from Version 1.2.5 to 1.2.7 #16741Anh Tran
KeymasterHi Darren, can you please try re-installing the plugin? I've just checked and see the Loader class is available within the plugin.
Anh Tran
KeymasterHi Hazmi, I couldn't replicate this problem. Can you please give more details on that? A video/screenshot is appreciated.
Anh Tran
KeymasterYes, it's possible. Each relationship meta box has an ID:
{$relationship_id}_relationships_fromand{$relationship_id}_relationships_to. You can include these IDs in the form shortcode to show it on the front end.October 29, 2019 at 9:17 AM in reply to: Thumbnail field in frontend form allows any file type #16735Anh Tran
KeymasterHi Ryan, thanks for your feedback. The field actually doesn't filter the file type. There's a small workaround for that which limits the default file picker:
add_filter( 'rwmb_frontend_post_thumbnail', function( $field ) { $field['attributes'] = ['accept' => 'image/*']; } );I'll see if I can add a code to restrict file types with PHP (which is more secured).
-
AuthorPosts