• Resolved amandapiasta

    (@amandapiasta)


    I would like the default values in my form to be removed when that element is focused on, but not if something different has been written on blur.

    I have been using this code for other forms, but it doesn’t work when I put it into the Responsive Contact Form script area:

    //remove form values when user clicks in the field.
      $('.rmv-dft-val').click(
    		function() {
    			if (this.value == this.defaultValue) {
    				this.value = '';
    			}
    		}
    	);//close on click
    
    	$('.rmv-dft-val').blur(
    		function() {
    			if (this.value == '') {
    				this.value = this.defaultValue;
    			}
    		}
    	);// close on blur

    The website is https://taragaucher.com/directory/contact/

    https://www.ads-software.com/plugins/responsive-contact-form/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author August Infotech

    (@augustinfotech)

    Hello amandapiasta,

    please try removing functions onblur=”replace[field name]()” from Plugins\responsive-contact-form\include\ai-contact-form-template.php page and include your script in same page,
    and please correct errors in input fields, spacing before and after attributes as I found it on your site.

    If you still find any trouble, please let us know.

    Regards,
    August Infotech

    Thread Starter amandapiasta

    (@amandapiasta)

    Hi August,

    thanks for the reply. Where does the extra space come from? I have no idea why that is there. I am viewing it in developer tools for chrome and it shows me something like this:

    <div class="control-group message">
      :before
    <label class="control-label" for="ai_comment">...</label>
    <div class="controls">...</div>
      :after
    </div>

    I assume you are talking about the :before and :after spots …but I don’t know where those are being inserted.

    Thread Starter amandapiasta

    (@amandapiasta)

    Well i figured out how to remove the previous stated :before and :after … they were included from the contact.css

    It still does not seem to be working… seems to be another javascript error because if I do not include my code it works, but if I add it in, it doesn’t work. :/

    I have added the following in ai-contact-form-template.php above the functions:

    $(document).ready(function() {
    	//remove form values when user clicks in the field.
    	  $('.rmv-dft-val').click(
    			function() {
    				if (this.value == this.defaultValue) {
    					this.value = '';
    				}
    			}
    		);//close on click
    
    		$('.rmv-dft-val').blur(
    			function() {
    				if (this.value == '') {
    					this.value = this.defaultValue;
    				}
    			}
    		);// close on blur
    	});
    Plugin Author August Infotech

    (@augustinfotech)

    Hello amandapiasta,

    We have found below jquery error in your contact page.
    Error: TypeError: $ is not a function
    Source File: https://taragaucher.com/directory/contact/
    Line: 7254

    Solution is : put jQuery instead of $
    Kindly check and put below code in your template.

    jQuery(document).ready(function() {
    	//remove form values when user clicks in the field.
    	  jQuery('.rmv-dft-val').click(
    			function() {
    				if (this.value == this.defaultValue) {
    					this.value = '';
    				}
    			}
    		);//close on click
    
    		jQuery('.rmv-dft-val').blur(
    			function() {
    				if (this.value == '') {
    					this.value = this.defaultValue;
    				}
    			}
    		);// close on blur
    	});

    Thread Starter amandapiasta

    (@amandapiasta)

    Sweet, it works!

    Thanks August!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove default values’ is closed to new replies.