Accessing HTMLB checkbox in javascript
Hi,
I have the following scenario:
1) jsp "main.jsp" has a checkbox with id="chkBoxId"
2) In this "main.jsp" at the end, there is a jsp include
including another jsp "buttons.jsp" - which contains a
SUBMIT button.
3) On this SUBMIT button, I am calling a javascript
function "check()" in the "onClientClick" attribute.
4) In this "check()" function I want to access the
checkBox (present in "main.jsp")
Now when I try doing this using the following code in the check() function, it gives me a "Undefined is null or not an object".
function check(chkBoxId) {
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
var chkBox1 = eval(func(chkBoxId));
// The checkbox is obtained
if (chkBox1)
alert("Not Checked");
Plzz help me !!!
regards,
Jitendra
HI,
U can write the javascript function in the header tag or create a .js file in which u write the javascript code.
the javascript code can be like
function ValidateForm()
if(document.form1.s_material.value=="")
alert("enter material");
return false;
return true;
where form1 is id of form and s_material is iD of input field.
In your coding for button onClientClick like :
<htmlb:button id="s_but_submit"
width="20"
onClick="submit"
onClientClick="if(!ValidateForm(this))htmlbevent.cancelSubmit=true;"
Regards,
Siddhartha
Similar Messages
-
Refresh HTMLB checkbox by JavaScript
Hi all, I have two HTMLB checkboxes on the browser(IE6.0).
I would like to selecte one of thses and set the other one
checked or unchecked. I can get the checkbox's ID on the client side. I can display the boolean value if the checkbox is checked or unchecked. But I can not set the checkbox checked or unchecked and let it displayed. The Javascript code on client side is shown as below:
// ckid - id of the target checkbox,
// myContent - objct of PageContext
// test() is triggered by one of the two chechboxes
//String ck_id=myContext.getParamIdForComponent(ckid);
<script language="JavaScript">
function test()
var myval = document.getElementById('<%=ck_id%>');
alert(myval.checked);
myval.checked = true;
Any hint will be appreciated.
Best regards.
WangHi Dagfinn, thanks for reply. My code is as follows, the missing 'e' is my typing error,
String s2 = "<script>"
+"function toggle1(){"
+"document.forms[\'myForm\'].checkbox1.checked=!document.forms[\'myForm\'].checkbox1.checked"
+"}"
+ "function toggle2(){"
+"document.forms[\'myForm\'].checkbox2.checked=!document.forms[\'myForm\'].checkbox2.checked"
+"}"
+"</script>"
+"<body>"
+"<form name=\"myForm\">"
+"<INPUT TYPE=CHECKBOX NAME=\"checkbox1\" onClick=\"toggle2();\">Check me1</input>"
+"<INPUT TYPE=CHECKBOX NAME=\"checkbox2\" onClick=\"toggle1();\">Check me2</input>"
+"</form>"
+"</body>";
getForm().addRawText(s2);
The error message happens to both of them when they are clicked.
Thanks for reply.
BR.
Wang -
Controll HTMLB:Checkbox via JavaScript
Hi all,
I`ve created a BSP application containing HTMLB:Checkbox components.
In this example the checkboxes are organized as a three of 2 levels.
When clicking/checking the parent checkbox, I want the rest of the checkboxes (children) to change status depending on their parent's status. e.g checked=true/false and disabled=true/false. The checkboxes become disabled/enabled, but you cannot see any change in their checked/unchecked status.
Though this works fine with design="classic", it doesn't when using design="design2003"...
I have to use design2003 in my application, and want to use HTMLB:Checkbox instead of regular HTML Checkbox- which also works.
The javascript syntax follows:
(it's from a loop containing all the children checkboxes)
nodeEl = elements<i>;
nodeEl.checked = true/false;
nodeEl.disabled = false/false;
I would have appreciated any kind of help.
OgertThis is my intire code, Raja T. The Javascript works fine with regular HTML Checkbox, or HTMLB:Checkbox combined with classic design.
**HTML CODE
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<%<htmlb:content design="classic">%>
<htmlb:content design="design2003">
<htmlb:document>
<htmlb:documentHead>
<script language='javascript' src='control_checkbox.js'></script>
</htmlb:documentHead>
<htmlb:form>
<table width="309" border="1">
<tr>
<td width="299" bgcolor="#999999">
<htmlb:checkbox id = "E1"
text = "Parent"
checked = "true"
onClientClick = "check_chkbox('E1');"/>
</td>
</tr>
<tr>
<td><htmlb:checkbox id = "00111820|Chk0102|E1"
text = "Child 1.1.1.2"/>
</td>
</tr>
<tr>
<td><htmlb:checkbox id = "00111820|Chk0103|E1"
text = "Child 1.1.1.3"/>
</td>
</tr>
</htmlb:form>
</htmlb:document>
</htmlb:content>
**Javascript Code:
var forms;
var elements;
function check_chkbox(id) {
var el;
var nodeEl;
var splitname;
var ind = 2;
var name = id;
var tempname = split_name(id,'',ind);
if(tempname != '') {
ind = 1;
name = tempname;
getCheckBoxes();
el = document.getElementById(id);
if(!eval(el.checked)) {
for(i = 0; i < elements.length; i++) {
splitname = split_name(elements<i>.id,name,ind);
if(splitname != '') {
if(elements<i>.id != id && name == splitname) {
nodeEl = elements<i>;
nodeEl.checked = false;
nodeEl.disabled = true;
else {
for(i = 0; i < elements.length; i++) {
splitname = split_name(elements<i>.id,name,ind);
if(splitname != '') {
if(elements<i>.id != id && name == splitname) {
nodeEl = elements<i>;
nodeEl.checked = true;
nodeEl.disabled = false;
function split_name(name,splitname,ind) {
var split_array = name.split("|");
var size = split_array.length;
var string;
if(size == 3) {
if(splitname != '') {
string = split_array[ind];
array = string.split(splitname);
if(array[0] == '') {
return splitname;
string = split_array[1];
return string;
return '';
function getCheckBoxes() {
var tempArray = new Array();
if(elements == null) {
tempArray = document.all;
<%-- case Firefox, Netscape --%>
if(tempArray == null) {
forms = document.forms;
tempArray = forms[0];
elements = new Array();
for(i = 0; i < tempArray.length; i++) {
if(tempArray<i>.getAttribute("type") == "checkbox") {
elements[elements.length] = tempArray<i>; -
Access HTMLB controll in Javascript
Hi,
I am tring to access an HTMLB controll (InputField) from JavaScript, but having some problems...
I have created a DynPage and created an InputField: InputField inField = new InputField("inField");
Now, in the javascripts I am trying to access this InputField text with:
var txt = document.form.inField.value
but it does not work... I get a JavaScript error.
Any suggestion how to access the InputField from the JS? maybe with getElementByid?
Thanks in advance,
AviadHi Aviad,
Htmlb controls are not a direct reprsentation of html controls. The way to get hold of them is by following lines.
function validateField()
//htmlb_formid : this is automatically generated
//the following lines will get you the javascript function
//name to call to get hold of your input field
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
//The funtion is called with id of the input field
//which returns the htmlb control object
var inputfield = eval(func("fname_input"));
//this will get you the value of inputfield
var inputString = inputfield.getValue().toString();
<b>Note: Make sure you set jsObjectNeeded = true for the htmlb control.</b>
PS: Please consider rewarding points for helpful answer. thank you.
Message was edited by: Prakash Singh -
Usage of htmlb controls in javascript
hi,
Could anybody give links regarding the usage of htmlb controls in javascript?Hi Ganesh,
here comes some official documentation: http://help.sap.com/saphelp_nw04/helpdata/en/43/067941a51a1a09e10000000a155106/frameset.htm
Also see these threads on SDN: HTMLB-Javascript and Access HTMLB controll in Javascript
Hope it helps
Detlev
PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance! -
Accessing HTMLB from javascript
Hi expert,
Can someone explain how to access the attributes,methods avialable in javascript to access htmlb objects in a page,
Like for e.g.,
htmlbSL(this,2,'SUBMITVALUES:HandleSubmit')
Is there any document available?
Thank you
APHi AP,
I believe there is no documentation avaliable about this.
Maybe because this accessing method is not right to do
but I can explaint about the function htmlbSL
function htmlbEL(this,2,'SUBMITVALUES:HandleSubmit');
this = HTML element.
2 = event type index.
SUBMITVALUES:HandleSubmit = objectID:eventName
if you want to know list of event type index.
here the list:
<b>EVENT TYPE INDEX</b>
'htmlb:breadCrumb:click' 1
<b>'htmlb:button:click' 2</b>
'htmlb:checkbox:click' 3
'htmlb:image:click' 4
'htmlb:link:click' 5
'htmlb:radioButton:click' 6
'htmlb:tabStrip:click' 7
'htmlb:tree:click' 8
hope this can help you.
respeck,
-adyt- -
How can I access xml document from javascript whithin a JSP page
how can I access xml document from javascript whithin a JSP page?
I have a JSP that receives an XML document from a JavaBean, so I can access it within the entire JSP, but I need to access it from the javascript inside the JSP... and I have no idea how i can do this.
Thanks in advance!The solution would only work on MS IE browsers, as other browsers do not support an XML DOM.
It can be done, but you would be stuck with using the Microsoft broswer. If that is acceptable, I have some example code, and a book recommendation. -
Accessing java classes from javascript
Hi,
I have the following javascript function
function testjava {
var myString = new java.lang.String("Hello world"); // line 1
alert("len:"+myString.length()); // line 2
}It gives me a error at line 1 saying "'java' is undefined" in IE browser 5.5 sp2. But, both the lines execute correctly in netscape 6.
Can someone please help..
Thanks,
Vijay.It seems that IE 5.5 doesn't support accessing java classes in JavaScript, so try to install IE 6 to see if it works or maybe, you doesn't have installed propertly support for JVM in IE.
-
Access Custom Attributes in JavaScript and in Transactions
Hello,
I try to work with custom attributes. I've problems accessing the values in JavaScript and in transactions, but it works fine within .irpt pages.
What's the trick?
For a custom attribute called PLANT, can I write something like this in JavaScript?
var p = ;
Is there a way to access custom attributes in the Link Editor of an Action Block?
Kind Regards,
MatthiasHi Matthias,
it is not possible to integrate that kind of MII variables in JavaScript like you discribed before.
You are right that this kind of expression is possible in the .irpt file. The reason why it is working in the .irpt
but not in the .js is, that the MII script parser is only replacing in HTML content. Everywhere you have
scripting the parser will not replace the {...} markings (since the curly brackets also show start/end of functions aso.).
Variables to JavaScript
The easiest Way to get those variables is to create hidden fields in the .irpt file that you can access via JavaScript.
For example:
<input type="hidden" id="hidden_plant" value="{PLANT}" />
This will be parsed to (e.g.)
<input type="hidden" id="hidden_plant" value="Karlsruhe/DE" />
Now you can access this value in JavaScript via:
document.getElementById( "hidden_plant" ).value;
Variables to Transactions
To parse custom variables to a transaction you first have to specify corresponding transaction variables in the
transaction itself. After saving the transaction you can map those variables to Parameters in the Xacute-Query-Editor.
Including this transaction to your webpage you can simply assign the required value to the corresponding parameter.
For example if you mapped the Plant variable of the transaction to Param.1 you can specify the information in the .irpt
like:
<applet id="trx_test" ....>
<... />
<param name="Param.1" value="{PLANT}" />
</applet>
Another possibility is to set the value dynamically via JavaScript if you use:
document.getElementById( "trx_test" ).getQueryObject().setParam( 1, "Karlsruhe/DE" );
Native access to user variables via the BLE is not possible (as far as I know).
I hope this is what you wanted to hear?
Best Regards
Sebastian
Edited by: Sebastian Holzschuh on Jun 10, 2008 12:16 PM -
Access embedded reader with javascript
For a project I'm looking for a way to display pdf files within a webbrowser. I have IE8+ with acrobat reader available to me, so i can display any given pdf. But i would like to be able to change pages, jump to bookmarks with javascript functions in my html page.
So in other words: does acrobat reader have somesort of api through which i can access my document using javascript?Post the query in the forum for Acrobat SDK.
-
I want to access multiple checkbox value(its true or false when clicked)
dear sir
i want to access multiple checkbox value whether its true or not from one jsp to another jsp.how i can do this. because based upon checkboxes records are deleted and added.
when i check on checkboxes and click on delete button the records are deleted onlybased upon checks.and these request forward to another jsp.so plz tell me about this.
for example in gmail yahoomail or other mail various checkboxes are there. and if we check them and click on delete button then all checks mail are deleted.
i will be very thankul to u sir..
plz tell me.in this time i m in problem of this type.Disabled fields and unselected checkboxes/ radio buttons/ list elements are not tranmitted when a form is submitted. So when you try to getParameter() you'll only get the selected fields or you'll get a null if the field was disabled/ not selected.
When you use this for a set of checkboxes/ radio button, you'll only get the selected ones. If nothing was selected, you'll get null. Work on your logic with this in mind.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
---------------------------------------------------------------- -
Access to Data from Javascript
I have a propertie call it "country" in my "Data View" and I need access its value from javascript code to use in a IF sentence.
I try thinks such as "xfa.node.getAttribute("country")" but doens't work.
How can I access it?
Thanks.You can try like this:-
if(country.rawValue == "IN")
xfa.host.messageBox ("You selected India"); // This will display a pop-up
else
xfa.host.messageBox ("You selected some other country");
Chintan -
PPC Mini running 10.4.11 unable to access urls based on Javascript, get "Javascript void" at bottom of window.. Software up to date. Cannot find where to verify if JavaScript turned off.
I guess I verified this in following earlier IIIasss recommendations (whom I will respond to in detail after this).
I have used Firefox (cookies deleted after each session) successfully with this site (Zinni Optical), but something has changed over the last year and a half and, to my knowledge it isn't on my end. When I get response at all, and try to navigate to "My Favorites, etc., and nothing happens for a while, I try to refresh, only to get a "stopped" message with a blank screen.
Tried Safari and Internet Explorer browsers (all I presently have installed) without succerss. May go back to TenFourFox (which had it's own wierdness over time, which is why I uninstalled it. Don't know latest versions compatible with 10.4.11 of Safari (but Software update is satisfied I'm up to date) or Internet Explorer.
I'm out in the sticks using a Verizon (Novatel) MiFi in a metal building, and so require a Wilson external antenna, liightening arrestor, signal amplifier and inside rebroadcast antenna to boost cell phone signal from one to four bars. Hope I get similar boost for wireless-Airport connection, understand that is different frequency, but also boosted.
The site for the bank I do WebBillpay with has had a minor change...no longer do I get the option to sign off (six months to a year ago), otherwise, fine. -
Problem with accessing Signed Applet from javascript method
Hi,
I am facing the following problem while accessing Signed Applet from javascript method.
java.security.AccessControlException: access denied (java.io.FilePermission c:/temp.txt read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at FileTest.testPerm(FileTest.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
I am using jdk1.5 for my development...
Can anyone help to resolve this security issue. Urgent...
Thanks in advance.Hey thanks. I wasn't able to get it to work with that sample but I did find this very similar code that does allow javascript to call JFileChooser in an applets public method.
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction()
public Object run(){
//do your special code here
return null; //return whatever you want
It seems a bit tempermental in that if you don't select a file quickly, it will hang the browser....no perfect solution but I'm going in the right direction.
Thanks,
Scott -
How to access htmlb elements in a Tray using JavaScript?
Hi All,
I am working on a BSP app using MVC. I am trying to validate a couple of input fields, on a button click (OnClientClick) event.
I am able to validate the input fields if they are outside the tray. But i am not able to get it run through the JS code, when the input fields are in a tray.
Thanks for you time...
Regards,
ChenHi All,
Yes DuraiRaja - i am using the document.getElementById(' ').
In my app, I have a Main controller calling a View - Default.HTM,
This Default.HTM, in turn loads up three trays T1, T2, T3 and these tray elements in turn call up the controllers ctrl1, ctrl2, ctrl3 associated to them.
CTRL1 calls a view - View1 - V1.htm, which has the below code.
And on the below page all that i am trying to do is validate if "FieldVal" is blank or not.
I get an error on IE as "Object required"
I get a HTTP 501/505 error when i try to upload the code.
Thanks all !
Maybe you are looking for
-
Crystal Report Key figure formatted value
Hi, I have restricted key figures defined in my BEx query based on a 'Quantity' type key-figure. I have maintained a display setting for these RKFs restricting to just one decimal place (10.0). Now I am trying to make use of this format setting in my
-
Converting video cam tape file to digital?
Before I go buy or borrow someone's digital video camera to record a digital video file, I thought I'd ask if my iMac has some ability to translate a video tape file to a digital file? IOW, is there a way to input video from my older camera and then
-
Hi , I have created a table and i need to assign a transaction code to it. that is to edit that table user has to go through a transaction only.is there any way out
-
Unable to delete UBE versions from OMW
We are on JDE 8.2 and recently I created a project and added a UBE and four versions, I wanted to delete those four versions since we have other vesions for this ube that had replaced these older versions, i was able to delete the two out of those fo
-
Fix Pack 3- Which file do I install from the zip file provided
I just pulled the zip file onto my desktop to install fix pack 3. I thought it would just be one file to install since I already have Xclesius engage 2008 on my computer. But when I looked at the zipped file there was hundreds of files in there. Does