Skip to Content
author's profile photo Former Member
Former Member

Identify what it was selected with Checkbox

In my screen, I am displaying an HTML page with 3 check boxes and I have a button called "Process"

each of these three checkboxes represent a different material number

how can I take the values of these check boxes when user makes the selection

and click the button?

what i have so far is I have a javascript funtion that once the selection is made (checkboxes)

and user click the button I can find out what checkbox was selected but this in javascript so how can I related these with ABAP, my abap internal table?



Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Dec 15, 2014 at 08:25 PM

    You can pull the value out of the form fields:

    METHOD do_handle_event.


    checkbox1 = request->get_form_field( 'checkbox1' ).


    <input type="checkbox" id="checkbox1">

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 22, 2013 at 11:22 AM

    Did you use <htmlb:checkbox> element?

    If not , I can suggest you to use that element where you need to bind a model class variable against to a checkbox. So your variables will be filled with 'X' if the respected checkbox is checked.

    Here is the small exmp:

    You must created three vairables in your model class:

    say mv_mat_01 , mv_mat_02 and mv_mat_03.

    In in your view:

    <htmlb:checkbox id="CHK01"

    checked = "//model/mv_mat_01"/>

    <htmlb:checkbox id="CHK02"

    checked = "//model/mv_mat_02"/>

    <htmlb:checkbox id="CHK03"

    checked = "//model/mv_mat_03"/>

    here model is Model class objec


    If you don't want to use htmlb:checkbox element and still you prefer to go ahead with what you have done, then you need to add some more lines of code.

    In this scenario also, you need to define three variables in model class as mentioned above.

    Now add three hidden inputfields and which will be bound to respective three model class variables.

    <htmlb:inputField id = "IP_01"

    value = "//model/mv_mat_01"/>

    <htmlb:inputField id = "IP_02"

    value = "//model/mv_mat_02"/>

    <htmlb:inputField id = "IP_03"

    value = "//model/mv_mat_03"/>

    Now in your javascript function, try to set value to the hidden fields by script.


    function xyz(){

    if(check01.checked == true){

    document.getElementById('IP_01').value = 'X';


    document.getElementById('IP_01').value = ' ';


    if(check02.checked == true){

    document.getElementById('IP_02').value = 'X';


    document.getElementById('IP_02').value = ' ';


    if(check03.checked == true){

    document.getElementById('IP_03').value = 'X';


    document.getElementById('IP_03').value = ' ';




    I wrote some pseudo code only. You need to write according to your variables or checkbox names/ids.

    All the best.. 😊

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.