Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: Adding javascript validation using DataUtilities on create wizard

$
0
0

Hi Vino,

 

First you make the driver attribute a Enumerated Value list then thriugh javascript you first remove the value and again populate the value with the required one.

 

function customChangefunction(){

            var target = window.document.getElementsById("resultCombo");

            var src = window.document.getElementById("sampleCombo");

            var strUser = src.options[src.selectedIndex].value;

            alert(strUser);

            var colours = new Array('Black', 'White', 'Blue');

              var shapes = new Array('Square', 'Circle', 'Triangle');

            var names = new Array('John', 'David', 'Sarah');

 

 

                              while (target.options.length) {

                                        target.remove(0);

                              }

 

            switch (strUser) {

                      case 'one':

                          for (i = 0; i < colours.length; i++) {

                              createOption(target, colours[i], colours[i]);

                          }

                          break;

                      case 'two':

                          for (i = 0; i < shapes.length; i++) {

                          createOption(target, shapes[i], shapes[i]);

                          }

                          break;

                      case 'three':

                          for (i = 0; i < names.length; i++) {

                              createOption(target, names[i], names[i]);

                          }

                          break;

                          default:

                              target.options.length = 0;

                          break;

                }

        }

         function createOption(ddl, text, value) {

                  var opt = new Option(value,text);

                                          dd1.options.add(opt);

          }

 

Added one document for similar type of job.

 

Regards,

Kaushik


Viewing all articles
Browse latest Browse all 8876

Trending Articles