NooTheme Premium WordPress Theme › Forums › JobMonster › set a maxlenght on a custom field
- This topic has 9 replies, 2 voices, and was last updated 1 day, 7 hours ago by
thierry.
-
AuthorPosts
-
6 months, 1 week ago #1222428
Hi
I have a custom field type "number", I want to put a minlenght and max with a pattern between 0 and 9
how to do itAttachments:
You must be logged in to view attached files.5 months, 3 weeks ago #1222453Hi.
You can use the select type for that field to set minlength and max with a pattern between 0 and 9.
Regards.
5 months, 3 weeks ago #1222460Hi
Thanks for your reply, but where do I put this criterion? because I can't find it in the custom fields
Can you help me?
Thanks5 months, 3 weeks ago #1222477Hi.
This is setup for the select custom field: https://prnt.sc/tI_m30G4KzRz
Please recheck it.
Regards.
5 months, 2 weeks ago #1222496hi
it's not a select I wantI want the visitor to be able to enter only numbers and I want to limit the length to 9 digits max.
Thanks5 months, 1 week ago #1222516Yes, please go to this file: wp-content/themes/noo-jobmonster/framework/libs/custom-fields/render-fields.php
line 88 with the function noo_render_number_field()
and change the input code from
<input id="<?php echo esc_attr( $input_id ) ?>" <?php echo $class; ?> type="number" name="<?php echo esc_attr( $field_id ) ?>" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo $field_value; ?>"/>to
<input id="<?php echo esc_attr( $input_id ) ?>" <?php echo $class; ?> type="number" name="<?php echo esc_attr( $field_id ) ?>" value="<?php echo esc_attr( $value ); ?>" placeholder="<?php echo $field_value; ?>" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" maxlength = "9" />
This code will affect to all your number custom field.
Please recheck it.
Regards.
5 months, 1 week ago #1222526hi
I've made the change to my LIFEN field and it doesn't work
the field isn't limited in length and I can currently put letters and numbers when I only want numbers.5 months, 1 week ago #1222542Hi.
Please recheck it. https://prnt.sc/Vqg8a4tCj1xB
I have helped you edit the source code on this site https://olivier3.idwebsolution.fr
Now it will limit the input length of the number field to 9.
Please recheck it.
Regards.
4 months, 4 weeks ago #1222553hi
it's working
thank you very much
1 day, 7 hours ago #1222800<pre id="tw-target-text" class="tw-data-text tw-text-large tw-ta" dir="ltr" style="text-align: left;" tabindex="-1" role="text" data-placeholder="Traduction" data-ved="2ahUKEwj4p4WVq8mQAxV3NvsDHVpOItsQ3ewLegQICxAU" aria-label="Texte traduit : I just updated my theme and WordPress, but the function that limits the number of entries to 9 isn't working.
Could you tell me what you did to make it work? It still works on the olivier.idwebsolution.fr version, but it no longer works on my new domain, olivier4.idwebsolution.fr.Please tell me if it's a file in my child theme or not, and which one in particular, because I don't see any difference.
Thank you, Thierry">I just updated my theme and WordPress, but the function that limits the number
of entries to 9 isn't working.
Could you tell me what you did to make it work?
It still works on the olivier.idwebsolution.fr version,
but it no longer works on my new domain, olivier4.idwebsolution.fr.Please tell me if it's a file in my child theme or not, and which one in particular, because I don't see any difference.
Thank you, Thierry -
AuthorPosts
You must be logged in and have valid license to reply to this topic.
