milanmarkovic Posted August 30, 2017 Share Posted August 30, 2017 Hello, can anybody provide help how to retrive data from slider from javascript back to php file. I have defined rangleslider in php renderForm() and in javascript file but how to retrive slider value to php variable when submit button is pressed? Thank you! 'type' => 'rangeslider', 'label' => $this->l('Font size:'), 'name' => 'MPHI_TITLE_RANGE', 'min' => 10, 'max' => 50, 'step' => 1, 'value' => 30 {extends file="helpers/form/form.tpl"}{block name="field"} {if $input.type == 'rangeslider'} <div class="slajder"> <div id="slider-range" class="slajder-range"></div> <div class="title-font-slider"> <p> <input type="text" id="amount" readonly style="background:#ffffff; border-style: none; font-weight:bold;"> </p> </div> </div> <script type="text/javascript"> {literal} $( function() { var value = {/literal}{$input.value|intval}{literal}; console.log(value); $( "#slider-range" ).slider({ range: true, min: {/literal}{$input.min|intval}{literal}, max: {/literal}{$input.max|intval}{literal}, step: {/literal}{$input.step|intval}{literal}, slide: function( event, ui ) { /* $( "#amount" ).val(ui.values[ 0 ] + " px - " + ui.values[ 1 ] + " px");*/ $( "#amount" ).val(ui.values[ 1 ] + " px"); } }); /* $( "#amount" ).val($( "#slider-range" ).slider( "values", 0 ) + " px - " + $( "#slider-range" ).slider( "values", 1 ) + " px" ); */ $( "#slider-range" ).slider( "values",1,value); $( "#amount" ).val($( "#slider-range" ).slider( "values", 1) + " px" ); }); {/literal} </script> {else} {$smarty.block.parent} {/if}{/block} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now