cancel
Showing results for 
Search instead for 
Did you mean: 

CHECKBOX - Condition

RoBu
Explorer
0 Kudos

Hi Forum,

It is Sunday and I has a problem

I have a stateful BSP with a tabStrip and 2 tabStripItems.

In the tabStripItem 1 is a check box.

I mark this check box.

Now I change to tabStripItem 2.

Afterwards I change again to tabStripItem 1.

The check box is now marked no more.

How do I create it, which always possesses

the check box the correct condition?

Thanks in advanced, regards.

RoBu di AQu

That is my Coding. (you can test it with drag and drop)

Filed MARK TYPE STRING

-



<%@page            language            =        "ABAP"%>
<%@extension       name                =        "HTMLB"
                   prefix              =        "HTMLB"%>
<%@extension       name                =        "XHTMLB"
                   prefix              =        "XHTMLB"%>
<HTMLB:content     design              =        "DESIGN2003"
                   controlRendering    =        "SAP">
<HTMLB:document>
<HTMLB:documentHead/>
<HTMLB:documentBody>
<HTMLB:form        id                  =        "Test">
<XHTMLB:tabStrip   id                  =        "Test">
<XHTMLB:tabStripItem
                   title               =        "Strip_1"
                   name                =        "Strip1">
<HTMLB:checkbox    id                  =        "MARK"
                   text                =        "MARK"
                   key                 =        "X"/>
<br>
<HTMLB:textView    text                =        "MARK<%=MARK%>"/>
</XHTMLB:tabStripItem>
<XHTMLB:tabStripItem
                   title               =        "Strip_2"
                   name                =        "Strip2">
<br>
<HTMLB:textView    text                =        "MARK<%=MARK%>"/>
</XHTMLB:tabStripItem>
</XHTMLB:tabStrip>
</HTMLB:form>
</HTMLB:documentBody>
</HTMLB:document>
</HTMLB:content>

Accepted Solutions (0)

Answers (4)

Answers (4)

RoBu
Explorer
0 Kudos

Is there no solution for my problem?

Thanx a lot.

RoBu di AQu

RoBu
Explorer
0 Kudos

Hello Narinder, hello Hemendra,

Thanks for the feedbacks.

Unfortunately my problem is not yet solved.

I have 30 checkboxes on each tabStripItem

and more than 8 tabStripItem.

In addition a change of tabStripItem 1

after tabStripItem 2 Event does not release.

Actually it would have to function as with


<phtmlb:tristateCheckbox  id     =  "MARK"
                          state  =  "<%=MARK%>"

Are there still far/simpler solutions?

Can I set/delete the field MARK

directly with onClientClick?

Perhaps with Javascript?

Regards.

RoBu di AQu

Former Member
0 Kudos

Hi Roland,

if you have several checkboxes, try to use field symbols when using Hemendra's logic. That way, you would be able to define a "checked" variable for each checkbox, and set/reset them manually without using too much code. If you call your checkboxes "id_checkbox_01" to "id_checkbox_20", and the corresponding values for the check indicator "checked_01" to "checked_20", for instance, you could simply create a loop:

field-symbols: <w_checked_flag> type any.

data: wa_fieldname type string.

do 20 times.

add 1 to w_check_counter

concatenate 'checked_' w_check_counter

into w_fieldname.

assign (w_fieldname) to <w_checked_flag>

    • insert logic to determine whether value of field symbol <w_checked_flag> should be true or false

enddo.

in your layout, the checkboxes would be defined as:

<htmlb:checkbox id="<%= <w_checkbox> %>"

text="<%= <w_check_text> %>"

checked="<%= <w_checked> %>

onClick="<%= <w_cb_click> %>" />

Something like this. I'm using field symbols extensively, and they provide a great way to creating loops for handling any number of recurring elements with identical attributes.

Former Member
0 Kudos

hi,

do this;

Define an attribute say "check type string" default it to "FALSE".

for checkbox do:

<HTMLB:checkbox id = "MARK"

text = "MARK"

checked - "<%=check.%>"

key = "X"/>

now at server set/reset the values of attrib "check".

regards.

Former Member
0 Kudos

Hi Roland,

There is an attribute called <b>checked</b>. You can set it dynamically.

like add

checked = "<%=checked%>" 

to you htmlb:chekbox element, define a page attribute checked type boolean or char1 and set it in onInputProcessing when you click on tabStripItem2 using code as given below

DATA: checkbox TYPE REF TO CL_HTMLB_CHECKBOX.
checkbox ?= CL_HTMLB_MANAGER=>GET_DATA(
                                       request = runtime->server->request
                                       name    = 'checkbox'
                                       id      = 'cb1'
                                         ).
IF checkbox IS NOT INITIAL.
  checked  = checkbox->checked.
ENDIF. 

Hope it helps.

Regards,

Narinder