• Resolved bitstorm

    (@bitstormdesign)


    I have a conditional form with calculations using number fields but I want to avoid having 0.00 placeholder in each field. If I put something else in the placeholder optional field it makes no difference. Also leaving nothing in the default value field makes no difference either. Any ideas? Thanks

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @bitstormdesign

    I hope you are doing well today.

    Calculation field does not allow to use placeholders by default. I pinged our SLS Team so that they can review you query. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi again @bitstormdesign

    Please add a must-use plugin to your site’s wp-content/mu-plugins folder like this https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins, then add the following code to the plugin’s php?file:

    <?php
    add_action( 'wp_footer', 'wpmudev_remove_leading_zero_masking', 9999 );
    function wpmudev_remove_leading_zero_masking() {
    	global $post;
    	if ( is_a( $post, 'WP_Post' ) && !has_shortcode( $post->post_content, 'forminator_form' ) ) {
            return;
        }
    	?>
    	<script type="text/javascript">
    	jQuery(document).ready(function($) {
    		setTimeout(function() {
    			$('.forminator-custom-form').trigger('after.load.forminator');
    		}, 100);
    		
    		$(document).on('after.load.forminator', function(event, form_id) {
    			if ( event.target.id == 'forminator-module-4444' ) {
    				$('.forminator-number--field').each(function() {
    					$(this).on('focus', function() {
    						if ( !$(this).val() ) {
    							$(this).inputmask({'placeholder' : ''});
    						}
    					});
    				});
    			}
    		});
    	});
    	</script>
    	<?php
    }

    4444 should be replaced with your form ID. You can find your form ID in page source where form is located, or edit your form in WP Dashboard and URL of that page edit will contain that ID.

    We recommend testing this on the dev/staging version first before putting it on the live site.

    Kind Regards,
    Kris

    Thread Starter bitstorm

    (@bitstormdesign)

    Thanks for this Kris, that works great.

    Thread Starter bitstorm

    (@bitstormdesign)

    Hi Kris, It seems this solution has now stopped working and inserts a decimal place so when you enter a number a decimal appears and the number will be put in behind it like .123 unless you move your mouse before the decimal. Any ideas why this might be?

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @bitstormdesign ,

    Would you mind sharing your form with us? Please export the form as shown
    here https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export and share it using pastebin.com or a service like gdrive.

    kind regards,
    Kasia

    Thread Starter bitstorm

    (@bitstormdesign)

    Thanks Kasia, it seems when i make a duplicate of the form and embed into a new page the issues are no longer there. So this is strange. Perhaps so kind of cache problem, I have imported it here just in case. https://pastebin.com/C3rPZdJx

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    HI @bitstormdesign

    Thanks for response!

    I just tested your form with code shared earlier and it seems to be still working fine.

    If it works for you on duplicated form, it is quite possible that there is some caching issue but also please check form settings:

    in “Behavior” settings of the form, in “Rendering” section the form should have “Load form using AJAX” option disabled for this code to work; so if that option was changed at some point – it would be the cause of the issue.

    Best regards,
    Adam

    Thread Starter bitstorm

    (@bitstormdesign)

    Thanks will do that. Appreciate your time.

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @bitstormdesign,

    Since we haven’t heard from you for a while. I’ll mark this thread as resolved for now. Please feel free to re-open the thread if you need further assistance.

    Best Regards
    Nithin

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove 0.00 placeholder from number fields’ is closed to new replies.