Skip to Content
Former Member
Mar 02, 2006 at 06:23 AM

Javascript variable to ABAP variable


I have a view that contains the following code:

<script defer language="Javascript" > 
function text_edit(defaultSelected,defaultValue,myForm){ 
if (selectedText == ""){ 
selectedText = defaultSelected; 
selectedValue = defaultValue; 
customTextObject.cSelected = selectedText; 
customTextObject.cValue = selectedValue; 
textEditURL = "TextEdit.htm?option=" + selectedText + "&value=" + selectedValue; 
<b>customValue</b> = window.showModalDialog(textEditURL,customTextObject,customPageFeatures); 
var x = document.getElementById('customVal'); 
x.value = customValue; 
<htmlb:inputField id = "customVal"   
visible = "FALSE"   
value = "<%=<b>lv_customvalue</b>%>"/> 
<htmlb:button text = "Edit"   
onClientClick = "text_edit('<%=lv_selection%>','<%=lv_selectionvalue%>',this.form)"/>

But is says that x is null, meaning document.getElementById('customVal') doesnt get any value. And so, I cannot put the value of the javascript variable to an ABAP variable.

How can I transfer the value of my javascript variable(<b>customValue</b>) to an ABAP variable(<b>lv_customvalue</b>)?