Loading list of radio buttons- Struts

Hello All, i have a question based on this. How can I load a list of radio buttons instead of list of select values.
For eg., I have 5 questions and each question has 2 answers (yes/no). I iterate 5 questions coming from database. Now i need to generate 2 radio buttons (yes/no)for each question. The values for these radio buttons is also coming fom database.
I have sample code for generating list of drop downs. Can anyone help me with generating list of radio buttons. This is the sample code:
<html:select name="formBeanName" property="beanproperty" styleClass="formElementSelect" indexed="true">
<html:optionsCollection name="formBeanName" property="List" label="textValue" value="id" />
</html:select>
Thanks,
Sai

sai,
your bean C needs one more set of getter and setter to store noValues./text
<BEAN name="C">
<PROPERTY name="idYes" type="java.lang.String" access="get,set" />
<PROPERTY name="yesTextValue" type="String" access="get,set" />
<PROPERTY name="idNo" type="java.lang.String" access="get,set" />
<PROPERTY name="noTextValue" type="String" access="get,set" />
</BEAN>
When you populate that bean if it is 'Yes' then set yes fields else set 'No' fields.
then in jsp you would do..
I used nested tags which are convinient than logic tags..You can use it too.
I am not sure if this syntax is correct...for logic
<logic:iterate property="a" name="AForm" >
<bean:define id="b" property="b" type="java.util.List"/>
<bean:define id="yesValue" property="idYes" name="b"/>
<html:radio idName="b" property="idYes" value = "<%=yesValue%>" />
<bean:write idName="b" property = "yesTextValue"/>
//this will render radio as <input type="radio" name="a[0].value" value="yes">     yes
//for no
<bean:define id="noValue" property="idNo" name="b"/>
<html:radio idName="b" property="idNo" value = "<%=noValue%>" />
<bean:write idName="b" property = "noTextValue"/>
//this will render radio as <input type="radio" name="a[0].value" value="no">     No
</logic:iterate>
for nested it would be
<nested:iterate property="a" name="AForm">     
//generate radio option for yes                                   
<nested:define id="idYesValue" property="idYes" type="java.lang.String"/>           
<nested:radio value='<%=idYesValue%>' property="value"/>                              
<nested:write property="yesTextValue"/>
//generate radio option for no
<nested:define id="idNoValue" property="idNo" type="java.lang.String"/>                     
<nested:radio value='<%=idNoValue%>' property="value"/>                              
<nested:write property="noTextValue"/>          
</nested:iterate>
Ash

Similar Messages

  • Select List or Radio Buttons query with multiple tables join

    Hello,
    I'm having a problem creating a select list or a radio group item.
    I need to display the emp_first_name in the select list but have the return value of the order_id in the select list or radio buttons item.
    The tables are as follow:
    emp_table
    emp_id
    emp_first_name
    emp_last_name
    etc...
    orders_table
    order_id
    order_name
    emp_id
    etc...
    I need to display the emp_name from emp_table in the select list but return the order_id from the orders_table as the return value.
    How can I do this?
    Any help would be greatly appreciated.
    Thanks.
    Regards,
    NJ

    Hi NJ,
    Try:
    select e.emp_first_name d,
    o.order_id r
    from orders_table o
    inner join emp_table e on o.emp_id = e.emp_id
    order by 1You may have an issue with an emp_id being used for more than one order and, therefore, the employee's name appearing more than once in the list?
    Andy

  • Is it possible to have Dynamically changing list of  Radio buttons ?

    Hi,
    There is a list box which a list of values like 'State', 'City', etc.
    When the user chooses a value in the list box, based on the value chosen say 'City', I should display a list of Cities. The user should then be allowed to choose 1 and only city from the list.
    Is it possible to have list of radio buttons such that there is 1 radio button for each city and the user can then choose any one of the radio buttons ?
    In this case the number of cities and what those cities are is unknown. So I need to have a dynamically changing list of radio buttons. Is this possible ?
    Version of forms : Forms 6.0.5.
    Thanks in advance
    Aruna

    Hi Aruna
    You can create a lot of radio buttons and hide|display them in runtime. It is more suitable i think to use the t-list instead of radio.

  • Have a list of radio buttons control layer visibility

    Any help would be appreciated, I am very new to scripting for PDF actions in Acrobat XI Pro
    I have 4 different sets of radio buttons that a user has to answer yes or no to.  When certain sequences of radio buttons are selected it should set one of 4 text fields' visibility to on.  
    For example, if the sequence is
    No, Yes, Yes, No
    then I want only the 3rd text box made visible and the other ones to remain hidden. 
    There are 9 different combinations that need to turn on one of 4 fields at a time.  Is this possible?
    Thank you very much in advance.

    Thanks GKaiseril
    I have spent a little time trying to learn this and what I have so far is not working. 
    I have 4 Radio Button Groups set up named: "Group1", "Group2", etc
    I also have a Text box which is what I want to be visible or not called: "TextBox"
    Here is my script:
    if (Group1.rawValue == "1" and Group2.rawValue == "2" and Group3.rawValue == "3" and Group4.rawValue == "4") {
    TextBox.presence = "visible";
    else {
    TextBox.presence = "invisible";
    Thanks again!

  • How to disable the radio buttons in alv lsit .

    hi experts ,
    i created one alv list using oops alv . in list three radio buttons . i used code for that in fieldcat-icon = 'x' .
    then in internal table i passed radiobutton icon . using this code i get a radio buttons on list correct .
    but when iam displaying the alv list . i some rows i want radio buttons in disable mode .
    can any one explain

    Tiberiu,
    I think you need to change the webdynpro for java code using NWDI
    Thanks
    Bala Duvvuri

  • Radio button in alv report

    Hi experts,
    I am using radio buttons in alv report by using screen painter but error occurs in alv that screen doesn't exist in module.
    plz help me.

    Hi Ankita,
    check this program.
    *& Report ZALVGRID_WITH_RADIOBUTTONS
    *& This program shows how to realize radiobuttons in ALV grid lists
    *& using event HOTSPOT_CLICK.
    *& Screen 100:
    *& - Flow logic
    *& PROCESS BEFORE OUTPUT.
    *& MODULE PBO.
    *& PROCESS AFTER INPUT.
    *& MODULE PAI.
    *& - Screen elements: none
    *& - ok-code field -> gd_okcode
    *& GUI Status MAIN100:
    *& - F3 = 'BACK', Shift+F3 = 'EXIT', F12 = 'CANC'
    PROGRAM zalvgrid_with_radiobuttons.
    TYPE-POOLS: abap, icon. " INCLUDE . for releases < 6.20
    TYPES: BEGIN OF ty_s_sflight.
    INCLUDE TYPE sflight.
    TYPES: button1 TYPE iconname.
    TYPES: button2 TYPE iconname.
    TYPES: button3 TYPE iconname.
    TYPES: button4 TYPE iconname.
    TYPES: END OF ty_s_sflight.
    DATA:
    gt_sflight TYPE STANDARD TABLE OF ty_s_sflight,
    gs_layout TYPE lvc_s_layo,
    gt_fcat TYPE lvc_t_fcat.
    DATA:
    gd_okcode TYPE ui_func,
    go_docking TYPE REF TO cl_gui_docking_container,
    go_grid TYPE REF TO cl_gui_alv_grid.
    CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
    PUBLIC SECTION.
    CLASS-METHODS:
    handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING
    e_row_id
    e_column_id
    es_row_no
    sender.
    ENDCLASS. "lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    METHOD handle_hotspot_click.
    define local data
    FIELD-SYMBOLS:
    IS ASSIGNED ).
    Set all radio buttons "unselected"
    IS ASSIGNED ).
    Set selected radio button "selected".
    = icon_wd_radio_button.
    ENDIF.
    Force PAI followed by refresh of table display in PBO
    CALL METHOD cl_gui_cfw=>set_new_ok_code
    EXPORTING
    new_code = 'REFRESH'
    IMPORTING
    RC =
    ENDMETHOD. "handle_hotspot_click
    ENDCLASS. "lcl_eventhandler IMPLEMENTATION
    MAIN *
    START-OF-SELECTION.
    PERFORM select_data.
    PERFORM init_controls.
    PERFORM build_fieldcatalog.
    PERFORM set_layout.
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING
    i_structure_name = 'SFLIGHT'
    is_layout = gs_layout
    CHANGING
    it_fieldcatalog = gt_fcat
    it_outtab = gt_sflight.
    Link docking container to dynpro
    CALL METHOD go_docking->link
    EXPORTING
    repid = syst-repid
    dynnr = '0100'
    CONTAINER =
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    lifetime_dynpro_dynpro_link = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL SCREEN 100.
    END-OF-SELECTION.
    MODULE PBO OUTPUT *
    MODULE pbo OUTPUT.
    SET PF-STATUS 'MAIN100'.
    SET TITLEBAR 'MAIN100'.
    ENDMODULE. "PBO OUTPUT
    MODULE PAI INPUT *
    MODULE pai INPUT.
    Leave report
    CASE gd_okcode.
    WHEN 'BACK' OR
    'EXIT' OR
    'CANC'.
    SET SCREEN 0. LEAVE SCREEN.
    Refresh table display
    WHEN 'REFRESH'.
    PERFORM refresh_display.
    WHEN OTHERS.
    do nothing
    ENDCASE.
    CLEAR gd_okcode.
    ENDMODULE. "PAI INPUT
    *& Form BUILD_FIELDCATALOG
    text
    --> p1 text
    <-- p2 text
    FORM build_fieldcatalog .
    ALV List with Radio Buttons
    SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
    © 2007 SAP AG 7
    define local data
    DATA:
    ls_fcat TYPE lvc_s_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    I_BUFFER_ACTIVE =
    i_structure_name = 'ICON'
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_BYPASSING_BUFFER =
    I_INTERNAL_TABNAME =
    CHANGING
    ct_fieldcat = gt_fcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    DELETE gt_fcat WHERE ( fieldname <> 'NAME' ).
    NOTE: field ICON-NAME has data element ICONNAME.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    I_BUFFER_ACTIVE =
    i_structure_name = 'SFLIGHT'
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_BYPASSING_BUFFER =
    I_INTERNAL_TABNAME =
    CHANGING
    ct_fieldcat = gt_fcat
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE gt_fcat INTO ls_fcat
    WITH KEY fieldname = 'NAME'.
    IF ( syst-subrc = 0 ).
    DELETE gt_fcat INDEX syst-tabix.
    ENDIF.
    ls_fcat-fieldname = 'BUTTON4'.
    ls_fcat-coltext = ls_fcat-fieldname.
    ls_fcat-icon = 'X'.
    ls_fcat-hotspot = 'X'.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    ls_fcat-fieldname = 'BUTTON3'.
    ls_fcat-coltext = ls_fcat-fieldname.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    ls_fcat-fieldname = 'BUTTON2'.
    ls_fcat-coltext = ls_fcat-fieldname.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    ls_fcat-fieldname = 'BUTTON1'.
    ls_fcat-coltext = ls_fcat-fieldname.
    INSERT ls_fcat INTO gt_fcat INDEX 5.
    Renumbering of the columns
    LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
    ENDLOOP.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form SELECT_DATA
    text
    --> p1 text
    <-- p2 text
    FORM select_data .
    define local data
    DATA:
    ls_sflight TYPE ty_s_sflight.
    SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_sflight.
    ls_sflight-button1 = icon_wd_radio_button. " selected radiobutton
    ls_sflight-button2 = icon_wd_radio_button_empty.
    ls_sflight-button3 = icon_wd_radio_button_empty.
    ls_sflight-button4 = icon_wd_radio_button_empty.
    Alternatively: create icons using function module 'ICON_CREATE'
    on SAP releases where these icons are not available.
    MODIFY gt_sflight FROM ls_sflight
    TRANSPORTING button1 button2 button3 button4
    WHERE ( carrid IS NOT INITIAL ).
    ENDFORM. " SELECT_DATA
    *& Form INIT_CONTROLS
    text
    --> p1 text
    <-- p2 text
    FORM init_controls .
    CHECK ( go_docking IS NOT BOUND ).
    ALV List with Radio Buttons
    SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com
    © 2007 SAP AG 9
    Create docking container
    CREATE OBJECT go_docking
    EXPORTING
    parent = cl_gui_container=>screen0
    REPID =
    DYNNR =
    SIDE = DOCK_AT_LEFT
    EXTENSION = 50
    STYLE =
    LIFETIME = lifetime_default
    CAPTION =
    METRIC = 0
    ratio = 90
    NO_AUTODEF_PROGID_DYNNR =
    NAME =
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    OTHERS = 6.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Size of container = full screen size
    CALL METHOD go_docking->set_extension
    EXPORTING
    extension = 99999
    EXCEPTIONS
    cntl_error = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Create ALV grid instance
    CREATE OBJECT go_grid
    EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
    i_parent = go_docking
    I_APPL_EVENTS = space
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    I_NAME =
    I_FCAT_COMPLETE = SPACE
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Set event handler for event HOTSPOT_CLICK
    SET HANDLER:
    lcl_eventhandler=>handle_hotspot_click FOR go_grid.
    ENDFORM. " INIT_CONTROLS
    *& Form REFRESH_DISPLAY
    Refresh table display after switching the radiobuttons
    --> p1 text
    <-- p2 text
    FORM refresh_display .
    define local data
    DATA:
    ls_stable TYPE lvc_s_stbl.
    ls_stable-row = abap_true.
    ls_stable-col = abap_true.
    CALL METHOD go_grid->refresh_table_display
    EXPORTING
    is_stable = ls_stable
    I_SOFT_REFRESH =
    EXCEPTIONS
    finished = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. " REFRESH_DISPLAY
    *& Form SET_LAYOUT
    Set layout for ALV list
    --> p1 text
    <-- p2 text
    FORM set_layout .
    CLEAR: gs_layout.
    gs_layout-cwidth_opt = abap_true. " optimize column width
    gs_layout-zebra = abap_true.
    ENDFORM. " SET_LAYOUT
    Regards,
    Prasanth
    Reward if helpful

  • Help me with Radio Buttons and Subform fields, please!

    I've built a dynamic order form with three product options listed as radio buttons. The three options are "Contoured" "Standard" and "Custom". "Contoured" requires five subfields to be filled in if it is selected. "Standard" requires two subfields to be filled in if it is selected. "Custom" has no associated subfields.
    My problem is that I can't figure out a script that isolates the subfields to the appropriate radio buttons. Can anyone suggest a script to use?
    Thanks in advance.
    Brian

    Brian, to understand what I did, I will first explain my hierarchy.
    RBList has 3 radio buttons: A, B, C. Specify the Item Value for each Radio button, e.g. A=1, B=2, C=3. For radio button A, create 2 dropdown lists & 3 numeric fields and wrap in a subform called SubA - ensure you leave it as Visible presence. For radio button B, create 1 dropdown & 1 numeric, wrap in a subform called SubB, and make sure this is visible. I put my code on the subforms (SubA and SubB) rather than the radio buttons. Also, in order for the layout to be saved in Reader, if you want to save and reopen, you must use the script on the Calculate event. The Click event will not save the layout for you (learnt this from past experience in Designer 7.2 Designer 8 saves layout different again). The event Calculates the function as soon as you open up the file.
    Using JavaScript on the Calculate event, on the SubA subform would look like this:
    if (RBList.A.rawValue !=1) {
    this.presence = "hidden";
    else {
    this.presence = "visible";
    Using JavaScript on the Calculate event, on the SubB subform would look like this:
    if (RBList.B.rawValue !=2) {
    this.presence = "hidden";
    else {
    this.presence = "visible";
    The radio button C would not require script if there is not subform needed.
    Let me know if this works for you.

  • Help on Radio Buttons - Retreiving the value in a Servlet

    I am trying to use a Servlet to get values of list of Radio buttons in from a JSP. The problem is that I am getting a "null"
    My JSP has the following:
    <form name="AddNewClient" action="AddNewClient" method="POST">
    <input type="radio" name="TypeOfBusiness" value="Permanent Guarding" />Permanent Guarding (24/7)
    <input type="radio" name="TypeOfBusiness" value="Night Guarding" />Night Guarding
    <input type="radio" name="TypeOfBusiness" value="Interval Patrolling" />Interval Patrolling
    <td><input type="submit" value="Submit" name="Submit" /></td>
    </form>
    My Servlet has following:
    out.println (request.getParameter ("TypeOfService"));
    Anybody with an idea of what I am missing here. The drop-down list works just fine...but i dont want to use it
    Thanks in advance

    Gusha wrote:
    I am trying to use a Servlet to get values of list of Radio buttons in from a JSP. The problem is that I am getting a "null"Edited Code
    Please read it carefully its a simplest thing i can provide you :)
    function setSelection(choice)
         var select=0;
         select=choice;
         if(select=="Permanent Guarding")
              document.AddNewClient.Permanent Guarding.checked=true;
                                    document.AddNewClient.Night Guarding.checked=false;
              document.AddNewClient.Interval Patrolling.checked=false;
                                    document.AddNewClient.TypeOfBusiness.value="Permanent Guarding";
         if(select=="Night Guarding")
                                    document.AddNewClient.Permanent Guarding.checked=false;
                                    document.AddNewClient.Night Guarding.checked=true;
              document.AddNewClient.Interval Patrolling.checked=false;
                                   document.AddNewClient.TypeOfBusiness.value="Night Guarding";
         if(select=="Interval Patrolling")
                                    document.AddNewClient.Permanent Guarding.checked=false;
                                    document.AddNewClient.Night Guarding.checked=false;
              document.AddNewClient.Interval Patrolling.checked=true;
                                   document.AddNewClient.TypeOfBusiness.value="Interval Patrolling";
    </script>
    <form name="AddNewClient" action="AddNewClient" method="POST">
    <input type="radio" name="Permanent Guarding" value="Permanent Guarding"  onclick='setSelection(Permanent Guarding )'/>Permanent Guarding (24/7)<br />
    <input type="radio" name="Night Guarding" value="Night Guarding"  onclick='setSelection(Night Guarding)'/>Night Guarding<br />
    <input type="radio" name="Interval Patrolling" value="Interval Patrolling" onclick='setSelection(Patrolling)' />Interval Patrolling<br />
    <input type="hidden" value="" name="TypeOfBusiness" />
    <input type="submit" value="Submit" name="Submit" />
    </form>And get on the next page
    request.getParameter("TypeOfBusiness");Hope you get it
    Try and if any problem get back
    Sachin Kokcha

  • Radio Button and combo box in Pdf Report.

    Hi,
    I have to make a PDF report with text box,radio buttons and combo boxes.
    The data in the text box will populate from the data base table.
    Similarly the radion button will enable the particular radio button from  a set of available radion buttons as per the value from the database.
    Same with combo boxes.
    The report putput should come in PDF.
    Thanks

    Hi,
    The report sud be pdf output with details like name of person showing in textbox ,then there will be list of radio buttons out of which particular radio button will be checked  as per the option for that particular person in the database.same with combox with for example A,B,C option from the look up is coming but it will be showing the option as per the name of person.We can take the name of person as the primary key.
    The Problem with input controls is that they can be used to filter the report as radio buttons and combo box but they can't be sown in the report itself.

  • Wierd Radio Button Problem

    can we set the value of a radio button at runtime?
    Suppose there are two radio buttons: Yes and No.
    Suppose a user chooses Option1 from a drop down list, then Radio button Yes should be highlighted, if the user chooses Option 2 from the drop down list, then the Radio button No should be highlighted.
    I am trying the following code but its not working:
    if (option.rawValue == Option1)
    radioButton1.rawValue = true;
    else
    radioButton2.rawValue = true;
    Is it the rawValue property of radio button that I should use or something else?
    I am really stuck on this. Any help would be highly appreciated

    It's called RadioButtonList a "group" of radio options.
    In your example, in one RadioButtonList, you have 2 options: Yes and No. You should specify a value for each option in the RadioButtonList's Binding tab.
    By doing this you're able to change the value at run time:
    form1.subform.RadioButtonList.rawValue = "1"; // for Yes option.
    an so on.
    I hope this helpful.
    Diego

  • Adobe LiveCycle Designer 7 Radio Button Help

    HELP!!!
    I have a list of radio buttons which all denote a different value.
    How do I attach this value to each button, and then make the value of that button appear in a numeric field beside it and how can I de-select the button and its value?

    Radio buttons come in groups. In LiveCycle Designer, when you select a single button, you're selecting the entire group as far as the button values are concerned. Look on the Object window. You'll find a listing there of the radio button group values, and you can edit them.
    To get a value from a radio button just use the fields name.
    In JavaScript use this code for a Radio button group named MyRadio
    MyRadio.rawValue;
    You can find out more by watching this video:
    https://admin.adobe.acrobat.com/_a200985228/p87746471/
    Thom Parker
    WindJack Solutions
    www.windjack.com
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    http://www.adobe.com/devnet/acrobat/

  • Please help! How can I validate Radio Buttons and List Menu with PHP.

    Hello everyone, I have been learning PHP step by step and
    making little projects.
    The point is I find it easy to learn by doing "practical
    projects."
    I have been reading the David Powers's Book on PHP Solutions
    and it's really great, however there is nothing mentioned regarding
    Validating Radio buttons. I know the book cannot cover every aspect
    of PHP and maybe someone in here can help.
    I have been learning how to process HTML forms with PHP.
    The problem is every book or tutorial I have read or
    encountered fall short on validation.
    I'm wondering how I can learn to validate Radio Buttons and
    Select List Menu.
    I have managed to create validation for all other fields but
    have no clue as to how I can get validation for Radio Buttons and
    List Menu.
    I would also like an error message echoed when the user does
    not click a button or make a selection and try to submit the form.
    I would appreciate any help.
    Patrick

    It's not that default value is "None." In fact it's not. It
    will only be
    "none" when the form is submitted.
    Also if your submit button is names 'send' then
    $_POST['send'] will only be
    set if the form was submitted.
    Make sure you didn't hit the refresh button on your browser
    which usually
    reposts the information. Also make sure you did not reach the
    form from
    another form with the same button names.
    Otherwise paste the snippet.
    Also you can check what fields are set in the post array by
    adding this to
    the top of (or anywhere on) your page:
    print_r($_POST);
    Cosmo
    "Webethics" <[email protected]> wrote in
    message
    news:[email protected]...
    >
    quote:
    Originally posted by:
    Newsgroup User
    > Off the top of my head this should be no different than
    your radio buttons
    > except that 'productSelection' will always fail the
    !isset check when the
    > form is submitted since the default value is "None", and
    therefore always
    > set. :-)
    >
    > So how about this..?
    > <?php
    > if (isset($_POST['send']) and
    ($_POST['productSelection'] == "None"))
    > {echo "Please select a product.";}
    > ?>
    >
    >
    >
    >
    > "Webethics" <[email protected]> wrote
    in message
    > news:[email protected]...
    > > Another question - how do i applied the code you
    just showed me to
    > > select
    > > menu
    > > or select list?
    > >
    > > This is the list:
    > >
    > > <div class="problemProduct">
    > > <label for="productSelection"><span
    class="product_label">Product
    > > Name.</span></label>
    > > <select name="productSelection" id="products"
    class="selection">
    > > <option value="None">-------------Select a
    product----------</option>
    > > <option value="Everex DVD Burner">Everex DVD
    Burner</option>
    > > <option value="Vidia DVD Burner">Vidia DVD
    Burner</option>
    > > <option value="Excerion Super Drive">Excerion
    Super Drive</option>
    > > <option value="Maxille Optical Multi
    Burner">Maxille Optical Multi
    > > Burner</option>
    > > <option value="Pavilion HD Drives">Pavilion
    HD Drives</option>
    > > </select>
    > > </div>
    > >
    > > I thought I could just change the name is the code
    from operatingSystem
    > > to
    > > productSelection.
    > >
    > > Something like this:
    > >
    > > From this:
    > >
    > > <?php
    > > if (isset($_POST[send]) and
    !isset($_POST['operatingSystem']))
    > > {echo "Please select an operating system.";}
    > > ?>
    > >
    > > To this:
    > >
    > > <?php
    > > if (isset($_POST[send]) and
    !isset($_POST['productSelection']))
    > > {echo "Please select an operating system.";}
    > > ?>
    > >
    > > But this does not work, any ideas?
    > >
    > > Patrick
    > >
    >
    >
    >
    >
    > Hey, I tried this about but as you mentioned, since the
    default product
    > value
    > is "None" an error message appears when the page loads.
    >
    > Is there a way to code this things so that even though
    the default value
    > is
    > "None" there ia no error message untle you hit the
    submit?
    >
    > When I applied the code, it messes up the previous code,
    now the operating
    > system is requiring an entry on page load.
    >
    > When I remove the code from the list menu everything
    goes back to normal.
    >
    > I know this is a little much but I have no other
    alternatives.
    >
    > Patrick
    >

  • Variable drop-down lists according to radio-button input

    I need to restrict the display of drop-down lists according to a particular radio-button selection earlier on the form. Can I use a javascript call on the client side without linking to an external database along these lines:
    If radiobutton1 == 1
    then dropdownlist1 uses list1
    elseif radiobutton1 == 2
    then dropdownlist1 uses list2
    and so forth.
    Obviously the syntax is incorrect, but I need to know if it can be done before digging in further.

    Let's assume we have tree grouped radio buttons in a group of buttons, and a combo box object which displays a different list of elements depending of the chosen option.
    A very simple way to do it would be, for example, the following one:
    b [*] Radio Button Group - OnClick Event
    i // List of elements that will be loaded in the combo box object
    > var colorList = new Array("White","Blue","Red","Green");
    > var dayList = new Array("Monday","Tuesday","Wednesday","Thursday");
    > var tmarkList = new Array("Nike","Adidas","Reebook","Levis");
    i // ComboBox Object
    > var combo = xfa.resolveNode("Formulario1.ComboBox");
    i // Cleaning the combo...
    > combo.clearItems();
    > combo.addItem("Select one option to the list","");
    i // Filling the Combo
    i // "this" returns a button group where there are three radio buttons
    i // and the "rawValue" returns the selected index chosen in radio
    i // buttons.
    > switch(this.rawValue)
    > {
    > case "1":
    > for(nJ = 0; nJ < colorList.length; nJ++)
    > combo.addItem(colorList[nJ]);
    > break;
    > case "2":
    > for(nJ = 0; nJ < dayList.length; nJ++)
    > combo.addItem(dayList[nJ]);
    > break;
    > case "3":
    > for(nJ = 0; nJ < tmarkList.length; nJ++)
    > combo.addItem(tmarkList[nJ]);
    > break;
    >}

  • My form has a list of yes or no questions.  I want to use either cheboxes or radio buttons.  I can't make it work.  When I check yes for one question, it marks all yes answers for all other questions.  If I mark some radio buttons to answer, it unmarks la

    My form has a list of yes or no questions.  I want to use either cheboxes or radio buttons.  Unfortunatly I can't make it work.  When I check yes for one question, it marks all yes answers for all other questions.  If I mark some radio buttons to answer, it unmarks later.  Need immediate help!!!

    Is it that you are using a PDF-based form? Did you copy and paste the Yes/No fields all the way down your form? If so, then all of the yes/no boxes are copies of each other and have the same name and properties in the PDF.
    For example, if you had:
         Question 1 and Question 1 Yes/No checkboxes
         Question 2 and Question 1 Yes/No checkboxes
         Question 3 and Question 1 Yes/No checkboxes
         Question 4 and Question 1 Yes/No checkboxes
    Then whatever answer you selected in Question 1 would populate down through the rest of the form.
    Changing the Yes/No field properties in questions two through four would eliminate the problem.
    I hope that helps,
    Brian

  • Radio button state on region load...

    Is there a way to set the radio button state (click event) on a region load? The default value of 0 (read-only) works when clicked, but doesn't when the page initially loads, and it's like the button click event needs to take place at the region load time. The values are 1 and 0 set statically if that matters, and the hidden value does not get changed when the radio button with the value of 1 is selected.
    The button makes the button visible when 'edit' is selected and the button disappears when 'read-only' is selected which is the expected behavior.
    I do have a condition on the 'save' button for the value to not be zero which is based on the value from the radio button.
    My gut says it'll be a region header attribute or Java Script sort of thing and I've not found anything so far, and I'm hoping there's an Apex guru out there that has a recommendation.
    Thanks in advance!
    Matt

    I used some source I found on Denes' web site and added the call, but it didn't yield the result I was hoping for.
    <script type="text/javascript" language="javascript">
    $s('P8_RADIO_BUTTON','0');
    function f_showhideButtonRadio(pThis, pValue)
    {     var show_or_hide = html_RadioValue(pValue);
    if (show_or_hide == 0)
    {html_HideElement(pThis);}
    else
    {html_ShowElement(pThis);}
    function f_showhideButtonSelect(pThis, pValue)
    {     var show_or_hide = $x(pValue).value;
    if (show_or_hide == 0)
    {html_HideElement(pThis);}
    else
    {html_ShowElement(pThis);}
    </script>
    I'm quite new to the Java Script in Apex, so if I hosed this up, please let me know. Also, does that set the click event on or does that just set the value? The reason I ask is with a 0 or 1 it yielded the same result.
    Thanks!
    Matt

Maybe you are looking for

  • Hyperlinks (target="_blank") and buttons on same page problem.

    Another interesting problem. I have a hyperlink that is set to open in a new window (target='_blank') and execute the 'hyperlink1_action' on the server. The framework executes the javascript function 'hyperlink_submit' (in the formElements.js library

  • Get rid of the DirectTV salespeople harrasing your customers INSIDE your store

    Went to my local Best Buy today to buy some toner for my printer, and some other computer related items. I was almost immediately set upon by what I at first mistook for a Best Buy employee but soon realised was a DirectTV person who pestered me with

  • No content in email

    Have an intermittent problem with emails showing no content.  I can view via alternative webmail and see the content, but not in macmail.  Sometimes a shut down of mail and reopen shows the content.  Sometimes just waiting (wait time varies, but norm

  • How to use threads in JSP???

    hello i want to use threads with JSP. i want to write a jsp page which will start 2 different threads. the 1st thread should just display a message and the second page should redirect this page to another jsp page. till the redirection is goin on, th

  • Error with MIGO transaction

    Dears, I receive this error while doing MIGO "Transaction type is a mandatory field". Please advise in which field i can put the transaction type. Thanks in advance,