on 09-27-2005 2:22 PM
We are working on a BSP application and ran in to an issue. Does anyone know how to pass a value of a variable in Java(HTML) to ABAP?
HTMLB does not support drop down boxes within a Tree Node, therefore we were forced to use standard HTML with the HTMLB Tree Node function as below:
<% wf_string1 = ' TR - CM Trans Cash Mgmt  <select id= "select1" name="select1">'.
loop at tab into wa_value.
clear wf_option.
concatenate: '<option value="' wa_value '">' wa_value '</option>' into wf_option.
concatenate wf_string2 wf_option into wf_string2.
endloop.
concatenate wf_string1 wf_string2 '</select>' into wf_text. %>
<htmlb:treeNode id = "Test"
text = "<%= wf_text %>"/>
</htmlb:treeNode>
</htmlb:tree>
<br>
We are then trying to get the value from the html <select> <option> in to ABAP and this is where we are having a problem figuring it out.
Any Help would be greatly appreciated.
Welcome to SDN.
onchange of the dropdown set the selected value to a hidden form field and you have to make a server roundtrip to be able to assign ito to ABAP variable.
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eric,
it seems you haven't worked with JavaScript a lot before.
You cannot pass a javascript variable to ABAP in an instant - this is because javascript runs on the client and ABAP on the server.
The way to connect client and server is HTTP, therfore you have to use HTML form elements that get submitted in the HTTP request for your javascript variable.
Just like Raja mentioned for example.
In addition may I recommend www.w3schools.com as an excellent resource for HTML, JavaScript and lots of other useful stuff when starting with web development.
Cheers,
Max
Hai check out this code
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title="Input prompt " >
<script language="JavaScript" type="text/javascript">
function save_input_prompt()
{
var varient_name = prompt("Save Varient as ?","");
if (varient_name == null )
return false;
else if (varient_name == "" || varient_name == " ")
{
alert("Enter a valid input");
return false;
}
document.mainform.if_varient_name.value =varient_name;
alert( document.mainform.if_varient_name.value );
return true;
}
</script>
<htmlb:form id="mainform" >
<htmlb:inputField id = "if_varient_name"
value = "abc"
visible = "false" />
<htmlb:button id = "save_query_open"
text = "Save as"
onClick = "EVT_SAVE_QUERY"
onClientClick = "if(!save_input_prompt()) htmlbevent.cancelSubmit=true;"
tooltip = "Save Query" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
oninputprocessing
DATA lv_string TYPE string.
lv_string = request->get_form_field( 'if_varient_name' ).
Regards,
Venkatesh
User | Count |
---|---|
74 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.