cancel
Showing results for 
Search instead for 
Did you mean: 

How to set radio button in init

Former Member
0 Kudos

Hi people!

I'm sorry but i don't speak english.

I have the follow problem:

- When i check the radiobutton and save it, it works in database.

- But when i leave screen and after i come back to same screen the radio button showed is wrong:

I must define a node context? How to set it in the code to show the correct radiobutton?

Thank you!

Accepted Solutions (1)

Accepted Solutions (1)

anil_kumar259
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi Anil Kumar!

Thank you for your reply!

Could you put here an example de code for this?

anil_kumar259
Active Contributor
0 Kudos

Are you using RadiobuttonGroupbyKey or RadiobuttonGroupbyIndex??

Do you want to set the default value in the Radiobutton??

anil_kumar259
Active Contributor
0 Kudos

If you are using the RadioGroupByKey you can declare the the default value like below in the init method

public void wdDoInit()

  {

    //@@begin wdDoInit()

     

      wdContext.currentContextElement().setAttribute("value");

    

    //@@end

  }

Former Member
0 Kudos

Im using like this:

I believe this method to set the context bellow:

It is using RadiobuttonGroupbyIndex!

But i dont know how i acess the method in the first print called "carregarCentroCusto".

I tryed to open it, but showed me a popupwindow and request login/password for DTR Console. I never used DTR Console. Usually the methods were in ComponentController or View...

Can you help me?!

Former Member
0 Kudos

It is using RadiobuttonGroupbyIndex!


I dont understand this code


Answers (1)

Answers (1)

Former Member
0 Kudos

assuming that the database holds the information for the last selected radio button, you need to make a call to the database in the init method to determine which radio button should be selected before the screen is rendered when the application is first launched

at the moment, I think you have chosen the first radio button to be selected  by default and hence why it is selected when you launch your application.