AnsweredAssumed Answered

Dynamically change choice buttons

Question asked by richardlhughes on Feb 23, 2017
Latest reply on Feb 28, 2017 by andrew.x.childress@us.tel.com

I am not understanding how the change the choice values when they are selected to: render as buttons.

 

 

Here is what I have for now (based upon blog from Sean Fiene ):

 

 

NWF$(document).ready(function(){
   
var changeMe = NWF$('#' + dd1);
   
NWF$(changeMe).click(
function(){ var x = NWF$('#' + dd1 + ' option:selected').val();
       
console.log(x );

       
if( x == 'Option 1')
       
{
           
var y = ['tab1', 'tab2', 'tab3', 'tab4']
       
}
       
else if(x == 'Option 2')
       
{
           
var y = ['tab1', 'tab2', 'tab3', 'tab4', 'tab5']
       
}
       
else if(x == 'Option 3')
       
{
           
var y = ['tab1', 'tab2', 'tab3', 'tab4', 'tab6', 'tab7']
       
}
       
else
       
{
           
var y = 'error'
       
}
       
console.log(y);
       
       
var myTabs = NWF$('#' + dd2);
       
myTabs.empty();
       
NWF$.each(y,
function(val, text){
           
myTabs.append(
               
NWF$(
'<option></option>').val(val).html(text)
               
);
       
});
   
});
});

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Looks like I cannot use the option tags ''<option></option>" because when rendering as buttons there is possibly some kind of behind the scenes JavaScript rendering.

 

My guess it has to use something around the data-nfchoicevalue class.

 

 

Does anyone have insight around achieving this design?

 

 

Thanks in advance for your help!

 

Richard

Outcomes