Skip to Content
avatar image
Former Member

Radio Button client event

Is there a client side event for the radio button or radio button group like the check box?  I am developing an application where when the user clicks on a radio button in a RB group, the contents of a drop-down list should change. Any ideas or tips?

Thanks,

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 23, 2004 at 05:56 PM

    there is an example in PDK:

    HTMLB JavaScript API

    The JavaScript API allows access to HTMLB components in JavaScript programms. Every component which is capable of client side eventing, has to set the "jsObjectNeeded" attribute (inherited from the Component component) to TRUE so that the component can be accessed with the JavaScript API. See also the EventValidationComponent description for more details.

    Example for InputField

    Using the InputField component:

         Form form = (Form)this.getForm();

         InputField inf2 = new InputField("currencyDisplay");

      // Enable JavaScript object generation for access in JavaScript

         inf2.setJsObjectNeeded(true);

         inf2.setClientEvent(EventTrigger.ON_CHANGE, "calculateCurrencyToFrom()");

         inf2.setBCD("100");

         inf2.setWidth("250px");

         form.addComponent(inf2);

    Getting the inputField object in JavaScript:

         function calculateCurrencyFromTo(){

              var funcName = htmlb_formid+"_getHtmlbElementId";

              func = window[funcName];

              var inputfield = eval(func("currencyDisplay"));

      // Now we have the inputField, so we can access it, for example set a new value

              if (inputfield)

                     inputfield.setValue("100.23");

         }

    Getting the generated inputField ID in Java coding:

    The IdD of a HTMLB component is generate by the HTMLB API. To get the Id of a component use:

    InputField inf2 = new InputField("currencyDisplay");

    String inputfieldID = pageContext.getParamIdForComponent(inf2);

    The inputfieldID can now be used to access the component:

    -

    -


    RadioButton

    To get the radio button object use:

         function calculateCurrencyFromTo(){

              var funcName = htmlb_formid+"_getHtmlbElementId";

              func = window[funcName];

              var rb = eval(func(htmlb_radiobuttonmodifier+"radiobutton"));

               .

               .

         }

    enabled

    A boolean value that indicates if the component is enabled (=true) or disabled (=false).

    id

    Identification code of the component.

    Properties Methods

    id setEnabled()

    isEnabled setDisabled()

    BR, Oliver

    Add comment
    10|10000 characters needed characters exceeded