Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Jquery ui slider and change function

Posted on 2013-06-25
4
Medium Priority
?
378 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39274357
Where is you SideBarPrice hidden field or slider??
0
 

Author Comment

by:maccaj51
ID: 39274369
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 2000 total points
ID: 39274376
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
ID: 39313845
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

596 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