How can I re-display my selected option?

In my jsp, I gain option values for a list of 'types' and 'names'
If the currentType = null I do not show the form that accepts the 'names'.
When a type is selected the Action class calls the getMethod in the ActionForm
and upon success returns to the jsp page and presents the 'name' form.
Unfortunately the 'type' form redisplays the first type in the list and not the
currentType.
Question. How can I set the selected option in my form to display the currentType?
<!-- Access session bean for picklist types -->
<jsp:useBean
id="typesBean"
scope="session"
class="com.aaa.zzz.refdata.beans.CPartyTypesBean" >
<jsp:setProperty name="typesBean" property="*" />
</jsp:useBean>
<%
CPartyTypesBean typeBean = (CPartyTypesBean) session.getValue("typesBean");
String[] PicklistTypes = typeBean.getTypes();
%>
<!-- Access Form Bean (ActionForm) for current Name & Type -->
<jsp:useBean
id="pb"
scope="session"
class="com.aaa.zzz.refdata.beans.CPartyPicklistBean" >
</jsp:useBean>
<jsp:setProperty name="pb" property="*" />
<%
String currentType = pb.getType();
String currentName = pb.getName();
%>
<html:form action="/typeAction" focus="type">
<table>
<tr>
<td WIDTH="20%">
Picklist Type
</td>
<td WIDTH="30%">
<select name="type">
<%
for(int i=0; i<PicklistTypes.length; i++)
out.println("<option>" + PicklistTypes[i] + "</option>");
%>
</select>
</td>
<td WIDTH="20%">
<html:submit property="submit" value="GetType"/>
</td>
<td WIDTH="30%">
</td>
</tr>
</table>
</html:form>
<%
if (currentType != null)
%>
<html:form action="/nameAction" focus="name">

Thanks Beattris, I guess 'selected' is the obvious answer but what I was looking for was
how to apply 'selected' to the loop that prints my options.
However I figured it out and did this:
<%
for(int i=0; i<PicklistTypes.length; i++)
String sel = null;
if(currentType != null && currentType.compareTo(PicklistTypes)==0)
sel = " SELECTED>";
else
sel = ">";
out.println("<option value=" + PicklistTypes[i] + sel + PicklistTypes[i]+"</option>");
%>

Similar Messages

  • How can I just display the selected value of a listbox in a report without the reverse display and selection buttons?

    I am using a table which contains a text field with a lookup. I want to use the selected value of this field in a form which is acting as a selection form. No editing of the field's value is permitted. How do I just display the value of the field (which
    is considered a listbox on the form) without the reverse display and the up and down selection buttons. 
    I can provide an illustration of the condition I am trying to overcome, but this system doesn't accept it.
    Thank you for any suggestions or clarification you can provide.
    Marj Weir

    Thank you.  I'll try that approach. 
    I found, after much experimentation, on a similar problem involving a multiselect lookup field,  that if I make the field invisible, and add a  textbox that displays the fieldname plus .column(0), it displays all the selected entries. 
    E.g.: staff.Column(0)
    Staff is the field containing the last names of selected staff members. 
    staff.Value only shows the first name in the lookup list whether it is checked or not, so this is useless.
    staff.column(0), however, (inexplicably) shows all the selected names, e.g. Jones, Smith, Wiggins.
    Marj Weir
     

  • How to display a selection option for service selection

    Dear All,
    I want to display the selection option ("Other sources") which I find
    in the /nse80 screen painter but cannot be display in the ME22N.
    /nME22N
    -> select one Purchase Order for Services
    -> select one Item Line
    -> at "Services" tab on Item Details Level
    -> Add new ICON behind "Serv. selection"
    Any ideas?
    Thanks,
    Neil

    Hi Sharmila,
    Thanks for your reply!
    Actually, I find a User Exit program ("EXIT_SAPLMLSP_011") in selection screen program ("SAPLMLSP" ). This User Exit is for the radio button ("Other sources").
    However, I don't know how to activate that button at ME22N.
    By the way, can you go more details on how screen exits work?
    Really thank for your support!
    Neil
    Message was edited by:
            Neil Lam

  • How many entries can we put in the select options

    Hi all,
    As per  my requirement I am trying to store the data in the select-option( s_kunnt)  as below
    select kunnr from kna1 into (l_kunnr) where
                and spart in p_spart.
      move 'I'         to s_kunnr-sign.
      move 'BT'        to s_kunnr-option.
      move l_kunnr to s_kunnr-low.
      move l_kunnr  to s_kunnr-high.
      append s_kunnr.
    endselect.
    Using s_kunnr in the select statement to fetch the data.
    When the customer numbers are more than 1800 in the s_kunnr, select statment going to the dump. Is number of entries in the select options are restricted for some count( around 1800)?.
    How many entries can we put in the select options?
    Thanks
    Regards
    Raj.

    Firstly, there is an error in your code. You should do the following instead:
    move 'I' to s_kunnr-sign.
    move 'EQ' to s_kunnr-option.
    move l_kunnr to s_kunnr-low.
    append s_kunnr.
    To answer your original question, the limit depends on the field width you are using in the ranges. If the field width is small, you can have thousands of entries in the range table.
    The limitation is in the length of the SQL statement string generated by the ABAP OPEN SQL engine. With the way I defined it above, the statement would have WHERE KUNNR IN ( 'value1', 'value2', 'value3'). With way you defined it, it would have WHERE KUNNR BETWEEN 'value1' and 'value1' and KUNNR BETWEEN 'value2' and 'value2'.
    When the range table is so large that it results in a short dump, you should look into FOR ALL ENTRIES option of SQL.

  • How can I validate a multi-select box to have at least 1 option

    How can I validate a multi-select box to have at least 1 option
    selected in struts?

    thanks i will try that other then that if I want to create single drop down list and pass multiple values associated to that drop list value how would i do that....

  • Is there a function module to display the selection options

    Hi all,
    How can I display the selection options (F2) popup, like the one in the data browser (SE11) selection screen? I have a custom report. Instead of right clicking on the selecion-options field, user want a button to click so the selection options popup appear on the screen. Is there a FM that I can use?
    Thanks in advance.

    Hello,
    i have tried debugging the standard code.... and i could find the below code which is triggering the F2 functionality for a field.
    CALL METHOD call_method
        EXPORTING
            method  = 'SetButtonState'
            p_count = 3
            p1 = fcode
            p2 = m_enabled
            p3 = m_checked
        EXCEPTIONS
            OTHERS    = 1.
    IF sy-subrc NE 0.
       RAISE cntl_error.
    ENDIF.
    class - CL_GUI_toolbar
    method - Set_button_state.
    You may try this.
    Regards,
    Venkatesh

  • How to write Error message for select options?

    Hi
    i have this select option statement
    SELECT-OPTIONS: s_fevor FOR afko-fevor.
    how to write error message for this?
    Regards
    Smitha

    Error messages are displayed for Select-options mostly on two conditions:
    1) You needs to check wether a value is entered or not its done by:
    a)
    Select-options:SELECT-OPTIONS: s_fevor FOR afko-fevor Obligatory.
       In this case error message is automatically throwed by system.
    b) You can do this in Selection Screen events.
    Ex:
    AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
    IF S_FEVOR-LOW IS INITIAL.
    MESSAGE 'XXXXX' TYPE 'E'.
    ENDIF.
    2) You need to Validate the entered value:
    You can do this in Selection Screen events.
    Ex:
    AT SELECTION-SCREEN./AT SELECTION-SCREEN ON S_FEVOR.
    SELECT FEVOR
                 FROM AFKO
                 INTO AFKO-FEVOR
                 UP TO 1 ROWS
    ENDSELECT.        
    IF SY-SUBRC NE 0.
    MESSAGE 'XXXXX' TYPE 'E'.
    ENDIF.
    Regards,
    Gurpreet

  • How to get the values of Select-options from the screen.

    The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.

    Hi,
    Refer this following code..this will solve your problem...
    "Following code reads value entered in s_po select options and willprovide search
    "help for s_item depending upon s_po value.
    REPORT TEST.
    TABLES : ekpo.
    DATA: BEGIN OF itab OCCURS 0,
    ebelp LIKE ekpo-ebelp,
    END OF itab.
    SELECT-OPTIONS   s_po FOR ekpo-ebeln.
    SELECT-OPTIONS s_item FOR ekpo-ebelp.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
      DATA:
      dyn_field TYPE dynpread,
      temp_fields TYPE TABLE OF dynpread,
      zlv_dynpro TYPE syst-repid.
      zlv_dynpro = syst-repid.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname     = zlv_dynpro
          dynumb     = syst-dynnr
          request    = 'A'
        TABLES
          dynpfields = temp_fields
        EXCEPTIONS
          OTHERS     = 0.
      LOOP AT temp_fields INTO dyn_field.
        IF dyn_field-fieldname EQ 'S_PO-LOW'.
            SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
            WHERE ebeln EQ dyn_field-fieldvalue.
            EXIT.
        ENDIF.
      ENDLOOP.

  • How to declare and work with select-option in screen painter?

    hello there,
    can anybody plz suggest me ,how to declare and work with select-option in screen painter?
    neon

    Hi Blue,
    Please check these threads which will help you a lot..
    module pool programming " to add selection-option on screen"
    Re: Select option in Dialog program screen
    Re: SELECT-OPTIONS in Screen
    Good luck
    Narin

  • FM which will display a select option in a pop up

    Hi All,
    I am looking for a FM which will display a select option in a pop up and prompt me to enter some value into it.
    I tried FM POPUP_GET_VALUES_USER_BUTTONS, &  POPUP_GET_VALUES  which allows me to enter only single parameter values and not a select option.
    Regards
    Puja

    Hi
    u can create by yourself, it's very easy and fast:
    TABLES BKPF.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECT-OPTIONS: S_BUKRS FOR BKPF-BUKRS,
                    S_BELNR FOR BKPF-BELNR.
    SELECTION-SCREEN END   OF SCREEN 100.
    CALL SELECTION-SCREEN 100 STARTING AT 5 10.
    IF SY-SUBRC = 0.
    *------> User has pressed F8
    ELSE.
    *------> User wants to leave the popup
    ENDIF.
    Max

  • How can I force any new selection from bookmark to open in a new frame ?

    How can I force any new selection from bookmarks to open in a new frame ?

    Sorry I would like it happen as a preference,
    automate the option like
    "Always open in new tab when click Bookmark "
    (not over the actual tab)
    thanks

  • How can I turn back the suggest option on iTunes when I purchase a song? somehow I close the window and now it doesn't come up

    how can I turn back the suggest option when I purchase a song? somehow I close the window that suggest the song similar to what we purchase on itunes

    NVM!!! Everything is strangely fine now!

  • I try to find something on my iPad, many results are emails, when I push on an email I can't see the email, because I get ever the first email,or the previous selected email in my inbox. How can I see the email selected?

    I try to find something on my iPad, many results are emails, when I push on an email I can't see the email, because I get ever the first email,or the previous selected email in my inbox. How can I see the email selected?

    Is your Yahoo account set up as POP3 or IMAP?

  • How to change date format in select-option (mm.yyyy).

    Hi,
       Plz, How to change date format in select-option (mm.yyyy).
      in my selection screen date type selection-option is there ,when i am enter date   it's  taken  dd.mm.yyyy format,but i want mm.yyyy format.
    how to set that .
    Regards,
    Kk.

    sorry
    parameters : pmonyr type spmon or
    select-options : sspmon for PGPL-spmon .
    or what table ccontains spmon.
    regards
    shiba dutta

  • FM which will display a select option

    Hi All,
    I am looking for a FM which will display a select option in a pop up and prompt me to enter some value into it.
    I tried FM POPUP_GET_VALUES_USER_BUTTONS, which allows me to enter only single parameter values and not a select option.
    Regards

    Hi,
    Please try below function modules.....
    FC_POP_GET_RANGE
    RERA_POPUP_MD_RANGE_INPUT
    UG_WB_POPUP_TO_GET_RANGE
    Dont forgot to Reward me points .....
    All the very best....
    Regards,
    Sreenivasa sarma K.
    Edited by: sharmashree kashi on Mar 26, 2008 2:59 PM

Maybe you are looking for