ui action

carlosromero
Giga Contributor

i have created a field (checkbox) on change form and its doing the following when is set to true is taking away the request apporval action both the one from the top of the form and the one at the bottom of the form using this code

client script

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

    if (isLoading|| newValue === '') {

          return;

    }

if (g_form.getValue('u_vendor_change') == 'true' ) {

document.querySelectorAll("#state_model_request_assess_approval")[0].hide();

        document.querySelectorAll("#state_model_request_assess_approval")[1].hide();

}

   

else {

document.querySelectorAll("#state_model_request_assess_approval")[0].show();

        document.querySelectorAll("#state_model_request_assess_approval")[1].show();

       

    }

}

when is click save is saving the changes, however if i want to set to false again the checkbox is displaying an error message

find_real_file.png

does anyone know what i am doing wrong

1 ACCEPTED SOLUTION

Here is a try/catch code with your script :


try{


  if (g_form.getValue('u_vendor_change') == 'true' ) {


            document.querySelectorAll("#state_model_request_assess_approval")[0].hide();


            document.querySelectorAll("#state_model_request_assess_approval")[1].hide();


  }


  else {


            document.querySelectorAll("#state_model_request_assess_approval")[0].show();


            document.querySelectorAll("#state_model_request_assess_approval")[1].show();


  }


  }catch(error) {


            console.log("Error on vendor change script "+error);


  }


View solution in original post

13 REPLIES 13

Here is a try/catch code with your script :


try{


  if (g_form.getValue('u_vendor_change') == 'true' ) {


            document.querySelectorAll("#state_model_request_assess_approval")[0].hide();


            document.querySelectorAll("#state_model_request_assess_approval")[1].hide();


  }


  else {


            document.querySelectorAll("#state_model_request_assess_approval")[0].show();


            document.querySelectorAll("#state_model_request_assess_approval")[1].show();


  }


  }catch(error) {


            console.log("Error on vendor change script "+error);


  }


that seems to resolve the problem for the time being. can i ask you the last part of the requirement i want that once vendor change is checked also the schedule ui action is display on the form and once i click on it change the state to scheduled   and the Reschedule option will be presented.



any idea on how can i achieve this


Goto your UI Action ("Schedule" UI action in your case) and based on your requirement write your script :


for example : for client side :


g_form.setValue('state',3);


Hi,



If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



Also, I would say, please open new thread for any new question/query/suggestion.