Solved

Jquery ui slider and change function

Posted on 2013-06-25
4
301 Views
Last Modified: 2013-07-10
Hi Experts,

I am trying to get my form to submit when the sliders hidden fields change! but cant seem to make it work... Could someone please assist.

I need it when .SideBarPriceField has a value change... or some workaround if thats not possible...

Many thanks in advance

<form method="get" id="SideBarPriceForm"> 
  <input id="SideBarPriceMin" class="SideBarPriceField" name="min_price" type="text" value="" />
  <input id="SideBarPriceMax" class="SideBarPriceField" name="max_price" type="text" value="" />
</form>


<script type="text/javascript">
$(document).ready(function () {
	
$(function() {
  $( "#SideBarPrice" ).slider({
    range: true,
    min: 0,
    max: 6000,
    step: 50,
    values: [ 2000, 4000 ],
    slide: function( event, ui ) {
      $( "#SideBarPriceValue" ).html( "£" + ui.values[ 0 ] + " - £" + ui.values[ 1 ] );
	  $( "#SideBarPriceMin" ).val( ui.values[ 0 ] );
	  $( "#SideBarPriceMax" ).val( ui.values[ 1 ]);
      }
    });
    
	$( "#SideBarPriceValue" ).html( "£" + $( "#SideBarPrice" ).slider( "values", 0 ) + " - £" + $( "#SideBarPrice" ).slider( "values", 1 ) );
	$( "#SideBarPriceMin" ).val($( "#SideBarPrice" ).slider( "values", 0 ))
	$( "#SideBarPriceMax" ).val($( "#SideBarPrice" ).slider( "values", 1 ))
	  	  
  });
  
});
</script>

Open in new window

0
Comment
Question by:maccaj51
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
Comment Utility
Where is you SideBarPrice hidden field or slider??
0
 

Author Comment

by:maccaj51
Comment Utility
sorry these should be hidden... had them on text for testing
<form method="get" id="SideBarPriceForm"> 
  <input id="SideBarPriceMin" class="SideBarPriceField" name="min_price" type="hidden" value="" />
  <input id="SideBarPriceMax" class="SideBarPriceField" name="max_price" type="hidden" value="" />
</form>

Open in new window

0
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 500 total points
Comment Utility
Try Using change:

 $( "#SideBarPrice" ).change(function(){
$.ajax({
        type : 'post',
        url : 'yoururl',
        data : {yourdata},
        success : function(data){
            // process to update here
        }
    });
});

Open in new window

Or here is a related solved question for ref:
http://stackoverflow.com/questions/13415041/jquery-slider-onchange-auto-submit-form
0
 

Author Closing Comment

by:maccaj51
Comment Utility
Thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need to learn promise API 2 26
populate dynamic drop down from a csv 3 34
Hovering effect 9 28
JavaScript Scope issue 4 15
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now