0

i'm trying to set an step progress bar inside an item, but i couldn't make it dinamicaly because i can't catch if the field value is changed.

so, can someone tell me if i can call the function when the value change?

i tryed to do with jquery :

$("#ctl00_ctl40_g_d316305f_70e1_4db0_b75a_312430a68b7b_FormControl0_V1_I1_D6").change(function(){
console.log("value changed");
});

but it didn't work

There is the image step progress bar i want to update it when the dropDown field that is under "stato" has been changed

  • Your code should work. Just double check id of the dropdown with broswer console. To check is jquery is able to get that control or not. – Bhaskar Dhone Aug 30 '18 at 12:47
0

EDIT:

As i understood your issue is related that your onchange has not been fired.

use try to use .on as below

<script>
   $(document).ready(function(){

    $('#ctl00_ctl40_g_d316305f_70e1_4db0_b75a_312430a68b7b_FormControl0_V1_I1_D6').on('change',function(){
    alert("hi");
});

   });
   </script>

now it should fire on change event.

There are few ways you can customize the list item with Status bar.

you can follow custom formatting of column step progress as link below

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting

if its Modern site sharepoint online then you can use Field Customizer to add additional Javascript functionlity. https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-field-customizer

if its Classic site and above 2013 version then you can either go with Adding Content editor (not recommneded) or using JSlink concept to implement the same functionality.

https://code.msdn.microsoft.com/office/Client-side-rendering-JS-2ed3538a
  • hi, thanks for the answer, i look around but i never find these links, i really appreciate it☺, but at the moment i'm making a step progress bar and i need to know if there are a method to run the script when the field value change. however i'm using SP 2013 – Federico Iannarelli Aug 30 '18 at 11:47
  • using JSlink there is option you can attach your custom JS to a Field. On change of the Field you can fire some events in the same script. I have done similar thing before like on change of a Field populated other Field, currently i dont have code handy,need to search – vinit kumar Aug 30 '18 at 11:56
  • could you show us which form you want to show this progress bar as static after hiding your site urls – vinit kumar Aug 30 '18 at 12:03
  • i added an image in the question – Federico Iannarelli Aug 30 '18 at 12:16
  • I have edited the answer try with .on event to bind on change event. – vinit kumar Aug 30 '18 at 13:07
0

Thanks you all for the answer, at the end i find a solution that it seems work :

var value = $("select#ctl00_ctl40_g_d316305f_70e1_4db0_b75a_312430a68b7b_FormControl0_V1_I1_D6 option:selected").text();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.