on 08-15-2013 1:00 AM
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?
thanks
neobat
You can pull the value out of the form fields:
METHOD do_handle_event.
...
checkbox1 = request->get_form_field( 'checkbox1' ).
.html:
<input type="checkbox" id="checkbox1">
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
<script>
function xyz(){
if(check01.checked == true){
document.getElementById('IP_01').value = 'X';
}else{
document.getElementById('IP_01').value = ' ';
}
if(check02.checked == true){
document.getElementById('IP_02').value = 'X';
}else{
document.getElementById('IP_02').value = ' ';
}
if(check03.checked == true){
document.getElementById('IP_03').value = 'X';
}else{
document.getElementById('IP_03').value = ' ';
}
}
</script>
I wrote some pseudo code only. You need to write according to your variables or checkbox names/ids.
All the best..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.