widget is not working properly in the portal

chandanpatra
Tera Contributor

Hi All, 

 i am  one error in this script ,

1.In the portal all the field value are showing whenever user click all the three buttons but i want if the user  select button 2 automatic button1 "Choose an option" should removed .  I am not able to know how to write array to resolve this issue 

2.whenever any select any one of the options it should save in the login  user record .Can anyone help me to resolve the issue .

HTML:

<div>
<button ng-click="c.open()" >button1</button>
<button ng-click="c.open1()" >button 2</button>
<button ng-click="c.open2()" >button3</button>

<div ng-if="data.showfield">
<label for="selectBox">Choose an option:</label>
<select id="selectBox" ng-model="data.selectedOption">
<option value="">--Select an option--</option>
<option value="a">Option A</option>
<option value="b">Option B</option>
<option value="c">Option C</option>
</select>
</div>
<div ng-if="data.showfield1">
<label for="selectBox">Choose an option:</label>
<select id="selectBox" ng-model="data.selectedOption">
<option value="">--Select an option--</option>
<option value="a">Option A</option>
<option value="b">Option B</option>
<option value="c">Option C</option>
</select>
</div>
<div ng-if="data.showfield2">
<label for="selectBox">Choose an option:</label>
<select id="selectBox" ng-model="data.selectedOption">
<option value="">--Select an option--</option>
<option value="a">Option A</option>
<option value="b">Option B</option>
<option value="c">Option C</option>
</select>
</div>
</div>

Client script:

api.controller=function(){
    var c = this;
 
    // Initialize the data
    // Initially hide the select box
 
    c.open=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield=true;
alert(c.data.showfield)
}
 
c.open1=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield1=true;
alert(c.data.showfield)
}
c.open2=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield2=true;
alert(c.data.showfield)
}
        
    };

server scipt:(function() {
data.showfield=false;
})();

 

chandanpatr_1-1727338342308.png

if you lick all the three buttons latest options should visible and other two should be removed.

 

Please help me 

 

 

Thanks ,

Chandan 

 

 

1 ACCEPTED SOLUTION

Patilgajanans
Tera Expert

Hii @chandanpatra  Just Make Some Changes In Client Script

 

api.controller=function(){
    var c = this;
 
    // Initialize the data
    // Initially hide the select box
 
    c.open=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield=true;
			c.data.showfield2=false;
			c.data.showfield1=false;
alert(c.data.showfield)
}
 
c.open1=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield1=true;
	c.data.showfield=false;
	c.data.showfield2=false;
alert(c.data.showfield)
}
c.open2=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield2=true;
	c.data.showfield1=false;
	c.data.showfield=false;
alert(c.data.showfield)
}
        
    };

Thank You !

View solution in original post

2 REPLIES 2

chandanpatra
Tera Contributor

Patilgajanans
Tera Expert

Hii @chandanpatra  Just Make Some Changes In Client Script

 

api.controller=function(){
    var c = this;
 
    // Initialize the data
    // Initially hide the select box
 
    c.open=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield=true;
			c.data.showfield2=false;
			c.data.showfield1=false;
alert(c.data.showfield)
}
 
c.open1=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield1=true;
	c.data.showfield=false;
	c.data.showfield2=false;
alert(c.data.showfield)
}
c.open2=function(){
        // Toggle the visibility of the select box
        alert('test');
c.data.showfield2=true;
	c.data.showfield1=false;
	c.data.showfield=false;
alert(c.data.showfield)
}
        
    };

Thank You !