cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox event disables checkboxes

Former Member
0 Kudos

Hi,

I am building a Search Component for the KM Using in NW 04 Stack 14.

In the Search Component I User Checkboxes to search in predefined Taxonomies.

To make it more easy to our Customers there should be a Checkbox to Search in all of these predefined Taxonomies. This Checkbox is per default enabled.

When a user select one of the other checkboxes for a single taxonomie search the checkbox should be automatically disabled.

At the moment I use the code below to create the checkboxes.

I tried the function setOnClick, but I don’t know the correct syntax to deactivate a checkbox by clicking another one.

Perhaps someone of you can help me.

Thanks

Sascha


private Component createCheckboxes()
	 
		{
				Checkbox AGS = new Checkbox(Search_WL.m_buzzwords[1]);
				AGS.setText(Search_WL.m_buzzwords[1]);
				AGS.setChecked(false);
				AGS.setTooltip(Search_WL.IndexTooltip[1]);
								
				Checkbox BS = new Checkbox(Search_WL.m_buzzwords[2]);
				BS.setText(Search_WL.m_buzzwords[2]);
				BS.setChecked(false);
				BS.setTooltip(Search_WL.IndexTooltip[2]);
				
				Checkbox EDV = new Checkbox(Search_WL.m_buzzwords[3]);
				EDV.setText(Search_WL.m_buzzwords[3]);
				EDV.setChecked(false);
				EDV.setTooltip(Search_WL.IndexTooltip[3]);
				
				Checkbox FS = new Checkbox(Search_WL.m_buzzwords[4]);
				FS.setText(Search_WL.m_buzzwords[4]);
				FS.setChecked(false);
				FS.setTooltip(Search_WL.IndexTooltip[4]);
				
				Checkbox KHM = new Checkbox(Search_WL.m_buzzwords[5]);
				KHM.setText(Search_WL.m_buzzwords[5]);
				KHM.setChecked(false);
				KHM.setTooltip(Search_WL.IndexTooltip[5]);
				
				Checkbox MAKO = new Checkbox(Search_WL.m_buzzwords[6]);
				MAKO.setText(Search_WL.m_buzzwords[6]);
				MAKO.setChecked(false);
				MAKO.setTooltip(Search_WL.IndexTooltip[6]);
													
				Checkbox VSS = new Checkbox(Search_WL.m_buzzwords[7]);
				VSS.setText(Search_WL.m_buzzwords[7]);
				VSS.setChecked(false);
				VSS.setTooltip(Search_WL.IndexTooltip[7]);
				
				Checkbox VPS = new Checkbox(Search_WL.m_buzzwords[8]);
				VPS.setText(Search_WL.m_buzzwords[8]);
				VPS.setChecked(false);
				VPS.setTooltip(Search_WL.IndexTooltip[8]);
				
				Checkbox Vertrieb = new Checkbox(Search_WL.m_buzzwords[9]);
				Vertrieb.setText(Search_WL.m_buzzwords[9]);
				Vertrieb.setChecked(false);
				Vertrieb.setTooltip(Search_WL.IndexTooltip[9]);
				
				Checkbox Alle = new Checkbox(Search_WL.m_buzzwords[0]);
				Alle.setText(Search_WL.m_buzzwords[0]);
				Alle.setChecked(true);
				Alle.setTooltip(Search_WL.IndexTooltip[0]);
			
				GridLayout grid = new GridLayout();		
								grid.setWidth("100%");
				grid.addComponent(AGS);
				grid.addComponent(BS);				
				grid.addComponent(EDV);
				grid.addComponent(FS); 
				grid.addComponent(KHM);				
				grid.addComponent(MAKO);
				grid.addComponent(VSS);
				grid.addComponent(VPS);				
				grid.addComponent(Vertrieb);
	grid.addComponent(Alle);

				return grid;
		}

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sascha,

You can implement a javascript function to disable the other chekboxes one you click a particular chekbox. You can call this javascript function on the onClientClick of this checkbox. So when you click this checkbox all the other chekboxes will get disabled.

in the javascript function you can write something like this..

document.forms[0].<%= compId %>.enabled = false;

you can get the dynamic id of the HTMLB component from your java class like this.

compId = pageContext.getParamIdForComponent(chkBox);

where pageContext is the IPageContext.

hope it helps

cheers

Kiran