cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Hidden field & javascript variable

Former Member
0 Likes
961

Hi BSP experts,

within my BSP form I had to use some javascript parts. I am not really familiar with javascript and have the following problem:

I created a javascript variable:

var name = document.getElementById('name').value;

Variable 'name' is filled by a form field, but now I have the problem to fill the hidden field with the variable value (I need that hidden field for data posting):

<input type = "hidden"

name = "NAME_LAST"

id = "NAME_LAST"

value = '"NAME"' />

In my example, the value of my variable is not considered, but it is only as string interpreted.

Best regards

Tom

View Entire Topic
Former Member
0 Likes

Hi,

This sample code can be helpful to you,

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<head>
<SCRIPT language="JavaScript">
function func()
{
<%
  if flag is initial.
%>
var txt;
txt = "Hello";
document.formBody.if01.value = txt;
document.formBody.submit();
<%
  endif.
%>
}
</SCRIPT>
</head>
<htmlb:content design="design2003" >
  <htmlb:page title  = " "
              onLoad = "func()" >
    <htmlb:form id="formBody" >
      <htmlb:inputField id      = "if01"
                        type    = "string"
                        visible = "false"
                        size    = "20" />
      <htmlb:textView text   = "<%= temp %>"
                      design = "EMPHASIZED" />
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

Thanks & regards,

Ravikiran.