cancel
Showing results for 
Search instead for 
Did you mean: 

how to give inputfields for radiobuttons

Former Member
0 Kudos

Hi all,

I am developing one application in which i require three radio buttons for that i used radiobutton group.

Now my requirement is to give three input fields to the corresponding radiobuttons.

for example

radiobutton1(name) inputfield1

radiobutton2(hno) inputfield2

radiobutton3(eid) inputfield3

I think u got my requirement.

please any one can provide me the solution.

Thanks in advance

Regards

Ravi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

can u plz teel me what is use of radio button in your application?like what is action on radio button?

Thanks

Abhilasha

Former Member
0 Kudos

Hi,

My requirement is as follows

name ravi

house 1-62

i want like this when i click on first radiobutton i should able to enter my name.

if i click on second radiobutton i should able to enter my house num.

on the whole i should to enter either name or house num at a time.

I think u got my requirement

Cheers

Answers (2)

Answers (2)

Former Member
0 Kudos

solved

gill367
Active Contributor
0 Kudos

HI,

For this design create one transperent container.

Insert two transaparent container in that.

put radiobuttongroup in one and three input fields in the other.

select grid layout for both of them with col count = 1.

Select grid layout for outer container with col count =2.

In this way desired layout is deisgned.

Please let me know if you still have any problem.

Sarbjeet Singh,

Former Member
0 Kudos

Hi,

I tried accordingly but i didnt got my requirement.

name ravi

house 1-62

i want like this when i click on first radiobutton i should able to enter my name.

if i click on house i should able to enter my house num.

regards

gill367
Active Contributor
0 Kudos

Do you want the input fields disabled earlier and then

on selecting a particular radio button you want to enable that input field. is it so?

Former Member
0 Kudos

Hi,

yes i want like that only.when i click radiobutton then the corresponding input field should be active.

Cheers

Former Member
0 Kudos

And what is this good for?

Armin

gill367
Active Contributor
0 Kudos

Hi

Then you can control the readonly property of the input fields.

Just bind the read only property of the input fields to three attributes of boolean type and then control

their property by changing the value of attributes on the select event of the radiobutton group.

hope it is clear and you can imlement it.

If you require i can write the code for you also.

Regards,

Sarbjeet Singh.

Former Member
0 Kudos

Hi,

If Possible send me the code.

Cheers

Ravi

Former Member
0 Kudos

hi,

share the code.

Regards

Sharanya.R

Edited by: Sharanya.R on May 15, 2009 12:09 PM

gill367
Active Contributor
0 Kudos

Hi Ravi,

Please find the code for that logic of controlling the readonly property of input fields.

//... 
 public void onActionselectindex(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionselectindex(ServerEvent)
    String selected_option = wdContext.currentContextElement().getA(); //where A is the attribute in the 
                                                                       //context used as the selected key for radiobuttongroup
    if(selected_option != null)
    {
    	if(selected_option.equalsIgnoreCase("name"))
    	{
           wdContext.currentContextElement().setReadoonlypro_input_1(true);  //context attributes bound to the readonly property 
           wdContext.currentContextElement().setReadoonlypro_input_2(false);  //of all the input fields.
		   wdContext.currentContextElement().setReadoonlypro_input_3(false);                            
    	}
    	else if(selected_option.equalsIgnoreCase("rollno"))
    	{
			wdContext.currentContextElement().setReadoonlypro_input_1(false);
			wdContext.currentContextElement().setReadoonlypro_input_2(true);  
			wdContext.currentContextElement().setReadoonlypro_input_3(false); 
    	}
    	else if(selected_option.equalsIgnoreCase("class"))
    	{
			wdContext.currentContextElement().setReadoonlypro_input_1(false); //context attributes bound to the readonly property 
			wdContext.currentContextElement().setReadoonlypro_input_2(false);  //of all the input fields. 
			wdContext.currentContextElement().setReadoonlypro_input_3(true); 
    	}
    }
    //@@end
  }

Regards,

Sarbjeet Singh GIll

Former Member
0 Kudos

public void onActionselectindex(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionselectindex(ServerEvent)

String selected_option = wdContext.currentContextElement().getA(); //where A is the attribute in the

//context used as the selected key for radiobuttongroup

if(selected_option != null)

{

if(selected_option.equalsIgnoreCase("name"))

{

wdContext.currentContextElement().setReadoonlypro_input_1(true); //context attributes bound to the readonly property

wdContext.currentContextElement().setReadoonlypro_input_2(false); //of all the input fields.

wdContext.currentContextElement().setReadoonlypro_input_3(false);

}

else if(selected_option.equalsIgnoreCase("rollno"))

{

wdContext.currentContextElement().setReadoonlypro_input_1(false);

wdContext.currentContextElement().setReadoonlypro_input_2(true);

wdContext.currentContextElement().setReadoonlypro_input_3(false);

}

else if(selected_option.equalsIgnoreCase("class"))

{

wdContext.currentContextElement().setReadoonlypro_input_1(false); //context attributes bound to the readonly property

wdContext.currentContextElement().setReadoonlypro_input_2(false); //of all the input fields.

wdContext.currentContextElement().setReadoonlypro_input_3(true);

}

}

//@@end

}

gill367
Active Contributor
0 Kudos

Is your problem not yet solved .

If solved then give the points.

Sarbjeet Singh

Former Member
0 Kudos

Hi,

I have one more doubt how to clear the values in the inputfields.

suppose i selected radiobutton1(name) and i entered the name.Then i selected second radiobutton

then name input field is disabled but the data present in name inputfield is appearing i want to disappear that name.

i can use reset button.

but i want to clear that data whenever i click another radiobutton.

i think u got my question.

Regards

Ravi

Former Member
0 Kudos

Hi,

Write the this line in the same code.

wdContext.currentContextElement().setinput_1("");// contex attribute which binded to input filed value property.

Thanks

Abhilasha

Edited by: Abhilasha Dahare on May 21, 2009 12:04 PM

gill367
Active Contributor
0 Kudos

Hello Ravi,

Please modify the code as below




//... 
 public void onActionselectindex(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionselectindex(ServerEvent)
   //reset the input fields on each select event
         wdcontext.currentContextElement().setInput_1("");
         wdcontext.currentContextElement().setInput_2("");
         wdcontext.currentContextElement().setInput_3("");


    String selected_option = wdContext.currentContextElement().getA(); //where A is the attribute in the 
                                                                       //context used as the selected key for radiobuttongroup
    if(selected_option != null)
    {
    	if(selected_option.equalsIgnoreCase("name"))
    	{
           wdContext.currentContextElement().setReadoonlypro_input_1(true);  //context attributes bound to the readonly property 
           wdContext.currentContextElement().setReadoonlypro_input_2(false);  //of all the input fields.
		   wdContext.currentContextElement().setReadoonlypro_input_3(false);                            
    	}
    	else if(selected_option.equalsIgnoreCase("rollno"))
    	{
			wdContext.currentContextElement().setReadoonlypro_input_1(false);
			wdContext.currentContextElement().setReadoonlypro_input_2(true);  
			wdContext.currentContextElement().setReadoonlypro_input_3(false); 
    	}
    	else if(selected_option.equalsIgnoreCase("class"))
    	{
			wdContext.currentContextElement().setReadoonlypro_input_1(false); //context attributes bound to the readonly property 
			wdContext.currentContextElement().setReadoonlypro_input_2(false);  //of all the input fields. 
			wdContext.currentContextElement().setReadoonlypro_input_3(true); 
    	}
    }
    //@@end
  }

Regards

Sarbjeet Singh