on 2006 Mar 02 6:23 AM
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;
<script>
.....
<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>)?
Is there another way to get the name of the form?
Also,
document.all.customVal
is null.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you are using sub-controllers the you have to concatenate controller's ID to your inputField's ID.
e.g. If your subcontroller's id is <b>mySubController</b>
and inputField's ID is 'customVal'
then you can get inputfield's value using code
document.all("mySubController_customVal").value;
Try it once also.
Regards,
Narinder Hartala
TIP: You don't have to hardcode the subcontroller ID. In the view coding you can always use controller->component_id to get the current, complete subcontroller ID. That way if your view is reused by one than one controller or a different levels your code doesn't break:
document.all("<%= controller->component_id %>_customVal").value;
Thanks Thomas! It's working. I have a new problem.
After setting the value for the hidden fields, I want to refresh the page and so call a BAPI to update the data in the table. Since this is a view, I will put the BAPI call to the DO_HANDLE_EVENT method. Is this correct? If so, my problem is how can I say that when the refresh is done, it will call the BAPI? I don't have something that would trigger the event.
<bsp:htmlbEvent id = "myid"
onClick = "myonclick"
name = "ValueChanged" />
<script for="IP1" event=onchange type="text/javascript">
ValueChanged();
</SCRIPT>
in the above script for="IP1" is the name of the hidden form field.
any value change in that field will trigger serverside event.
Regards
Raja
Hi Raja!
This is my code:
<htmlb:inputField id = "customVal"
type = "string"
visible = "false"
value="<%=lv_text%>"/>
<bsp:htmlbEvent id = "myid"
onClick = "update_custom_value"
name = "ValueChanged" />
<script for="customVal"
event=onchange
type="text/javascript">
ValueChanged();
</SCRIPT>
then a javascript call will place a value on the hidden field, like this:
document.all("<%= controller->component_id %>_customVal").value = customValue;
When the value is transferred to the hidden field. I want to call a BAPI. But nothing happens when the hidden field is filled-up with a value. Is there something wrong with my code? Note that this is a view and not a BSP page.
I tried calling the ValueChanged in my javascript code but it shows "page cannot be displayed". What I want is to refresh the page and call the BAPI on refresh. How can I do that?
I added this code in DO_HANDLE_EVENT:
CASE htmlb_event->server_event.
WHEN 'update_custom_value'.
*do call bapi here...
ENDCASE.
Is this correct?
to place a http breakpoint, first external debugging should be activated
se80->utilities->settings->abap editor->debugging
check the check box (actv) in external debuggin box
hit enter and come out. now in the do_handle_event method place the cursor where you want to the break point and click the red icon with letters STOP, this will throw a popup asking whether you want HTTP break point or session break point , click the button HTTP break point.
Regards
Raja
User | Count |
---|---|
79 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.