Javascript issue in JSP
I have a submit button in my JSP. I called two javascript functions like onclick="call1();call2();". But it looks call1() function works and not call2(). How do I make both fns to work? Thanks.
Here's the source, basically populating values for hidden variables.
function getMktNames() {
//call this function while submiting form...
//array not holding values, when come back from confirmation and go again to confirm screen
var mkts = "";
for (var ctr = 0;ctr < document.getElementById('mrktId').options.length ; ctr++ ) {
if (document.getElementById('mrktId').options[ctr].selected){
//do not add , if the value is empty
if (mkts != "") {
mkts = mkts + ",";
mkts = mkts + document.getElementById('mrktId').options[ctr].text;
document.forms[0].mktsSelected.value = mkts;
function getMktShrNames() {
var mkts = "";
for (var ctr = 0;ctr < document.getElementById('mrktIdShr').options.length ; ctr++ ) {
if (document.getElementById('mrktIdShr').options[ctr].selected){
//do not add , if the value is empty
if (mkts != "") {
mkts = mkts + ",";
mkts = mkts + document.getElementById('mrktIdShr').options[ctr].text;
document.forms[0].mktsSelectedShr.value = mkts;
}
Similar Messages
-
CRM 2013 - Inconsistent javascript issue crash the web client and user needs to reopen
Hello,
We are using CRM 2013 on premise version and almost 600 users are using it. We have some inconsistent JavaScript issue (following is the log for same) which happens to users in a day or two. When this issue occurs user can not work in system and they have
to open new instance of CRM.
Does anybody knows about this error?
<CrmScriptErrorReport>
<ReportVersion>1.0</ReportVersion>
<ScriptErrorDetails>
<Message>Unable to get property 'location' of undefined or null reference</Message>
<Line>1</Line>
<URL>/_static/_common/scripts/main.js?ver=1676323357</URL>
<PageURL>/main.aspx#313155368</PageURL>
<Function>anonymous($p0,$p1,$p2){this.$3_3.get_currentIFrame()&&Mscrm.PerformanceTracing.write("Unload",this.$3_3.get_currentIFrame().src);this.$H_3=$p0.toString();this.$26_3();this.$1A_3();this.$1J_3();if($p0.get_isLocalServer())$p0.get_query()["pagemode"]="iframe</Function>
<CallStack>
<Function>anonymous($p0,$p1,$p2){this.$3_3.get_currentIFrame()&&Mscrm.PerformanceTracing.write("Unload",this.$3_3.get_currentIFrame().src);this.$H_3=$p0.toString();this.$26_3();this.$1A_3();this.$1J_3();if($p0.get_isLocalServer())$p0.get_query()["pagemode"]="iframe";addPassiveAuthParameters($p0);var$v_0=$p0.toString();if(IsNull($p2))$p2=false;var$v_1=this.$18_3($p0,$p2);if($v_1){if(this.$2z_3()){window.location.reload();return}this.$2d_3();this.$1s_3();Mscrm.PerformanceTracing.write("Navigate",$v_0);!Mscrm.Utilities.isIE()&&this.raiseEvent(Mscrm.ScriptEvents.UpdateTopLocation,null);this.$3_3.get_currentIFrame().contentWindow.location.replace($v_0)}else{this.$10_3();var$v_2=this.get_contentWindow().Sys.Application.findComponent("crmPageManager");if($v_2){!Mscrm.Utilities.isIE()&&$v_2.raiseEvent(Mscrm.ScriptEvents.UpdateTopLocation,null);var$v_3={};$v_3["sourceUri"]=Mscrm.Utilities.getContentUrl(null);$v_2.raiseEvent(Mscrm.ScriptEvents.IFrameReactivated,$v_3)}}window.self.InnerIFrameSrcChangeTimestamp=(newDate).getTime();this.title=$p1;if(window.LOCID_UI_DIR==="RTL"&&$p0.toString().indexOf("PersonalWall")>=0&&window.UseTabletExperience)this.$3_3.get_currentIFrame().style.position="RELATIVE"}</Function>
</CallStack>
</ScriptErrorDetails>
<ClientInformation>
<BrowserUserAgent>Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)</BrowserUserAgent>
<BrowserLanguage>en-US</BrowserLanguage>
<SystemLanguage>en-US</SystemLanguage>
<UserLanguage>en-US</UserLanguage>
<ScreenResolution>1366x768</ScreenResolution>
<ClientName>Web</ClientName>
<ClientTime>2015-04-20T15:41:12</ClientTime>
</ClientInformation>
<ServerInformation>
<OrgLanguage>1033</OrgLanguage>
<OrgCulture>1033</OrgCulture>
<UserLanguage>1033</UserLanguage>
<UserCulture>1033</UserCulture>
<OrgID>{E8BBA7AE-A552-DE11-B475-001E0B4882E2}</OrgID>
<UserID>{614837CD-448B-DE11-A5E1-005056970D6C}</UserID>
<CRMVersion>6.1.2.112</CRMVersion>
</ServerInformation>
</CrmScriptErrorReport>Are you on-premise, or on-line? : It's on-premise
Can you reproduce it on-demand, or is it sporadic?: It's sporadic
There is a mention of loading an iFrame in the error, do you have iFrames on the form that generates this error?
It's not on specific forms, so can't identify that. Yes we have iframes on some forms.
Does it happen on any/all entity forms, or specific ones? Do the entity forms have any custom JavaScript on them?
It's not on specific forms. And yes we have javascript on almost all forms.
Do you have any network problems or slowness in your network? Does the problem happen when the network is busy?
We need to check this on next occurrence.
Do the users that see this error have any unusual add-ins or toolbars in their browser? This is not for specific user. Its happening for all randomly.
Have you tried other browsers like Chrome or FireFox and do users see the problem there as well?
We need to check only for IE. -
Passing javascript values to jsp without refreshing the page
Hi,
How do u pass a value of a javascript variable to the jsp without refreshing the page ?
For example, a file called test.jsp in which a javascript variable x contains value 254. I need to pass the value of x to a method declared in test.jsp(same page).Hi Mona,
when i say refresh i do mean a blink of the browser.
This is a small example i wrote to show you how you can pass javascript varables to JSP variables. If you don't want the refresh to be seen by the user just include this code in a hidden frame on a page and instead of refreshing the entire page, refresh the hidden frame.
i have to say, i didn't test the code so i don't guarantee it's flawless.
if you need an more detailed example just tell me, i'll create one, but it won't be for today :)
<html>
<head>
<title>Log in to the system</title>
</head>
<body>
<script>
//we retrieve the parameter 'user' from the URL
<%
String username = request.getParameter("user");
%>
var user = "<%= username%>";
//check if there is a username in the URL
if(user=="null")
//there is no username so we log the person in as a guest
user="guest";
//we refresh the page and set the user parameter to 'guest'
//the parameter now contains the javascript variable 'user'.
//The parameter can be read by the JSP (see the top op this script).
//This way we gave the javascript variabele to the JSP variable
location="login.jsp?user="+user;
else if(user=="guest")
{ alert("Welcome "+user+", I hope you like this site"); }
else
{ alert("Welcome "+user+", I'm glad to see you again"); }
</script>
</body>
</html> -
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. -
How can i assign a Javascript variable to JSP variable
Hi guys
how i can assign a javascript variable to jsp expression.,
e.g.,
<input type = "button" value = "Add more" onclick = "return submitform1('<%=s%>')">
function submitform1(String s)
var s1 = s
document.form1.action = "../intimation.do"; /* Here i want to pass the value s1 to jsp or servlets without using hidden fields and Query string*/
document.form1.submit();
return false;
/* i want to pass the values thru session whether it is possible */
pls give sample code
Reply
MarimuthuYou don't have the session.
All you have is HTTP.
The only way to communicate from the client to the server is via an HTTP request. The only way to send a value like that is with a parameter.
Using a form with method="submit" as mentioned will pass the parameters without displaying them in the url bar (is that what you wanted?) -
Passing JavaScript value to Jsp
Hi,
Any idea how to pass a value from javascript to jsp page when the page gets load on browser.
I use below code but an event is require to pass the value. Is there any code that pass automatically the value from javascript to jsp.
<html>
<head>
<title>Passing Javascript value to Jsp</title>
<script type="text/javascript" language="javascript">
var scriptVar = "Noy"
var WinNetwork = new ActiveXObject("WScript.Network")
document.write (WinNetwork.username)
document.index.hiddenTextBox.value = WinNetwork.username
</script>
</head>
<%
String jspVar = null;
if(request.getParameter("submit") != null){
jspVar = request.getParameter("hiddenTextBox");
out.println("Jsp Var : " + jspVar);
%>
<body>
<form name="index" onSubmit="index.jsp" method="post">
<input type="hidden" name="hiddenTextBox"><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
Thanks,
~ukbasakJSP/Java runs at the server side, produces a HTML page, sends it to the client side and then stops running.
HTML, containing under each CSS and JS, arrives at the client side and runs at the client side only.
To invoke JSP/Java using HTML you need to fire a request to the server side. That can be either a plain vanilla <a> link, a <form> to be submitted or an asynchronous Ajaxical request.
That said, the use of ActiveX in web applications is discouraged. It's a Microsoft IE proprietaty. With other words, it isn't and won't be supported by all alternative browsers which the other half of the world is using. -
How to pass javascript variable to jsp function
i want to check which table header (that is <th> in html )is clicked and based on that a jsp funtion do a query in database and should show records in sorted way according to which column head is clicked.
Table is created in html.
My function is
Vector varray = workcaseid.getWorkcaseId(Long.parseLong(MasterAccountNumber),SelectedColumn);
<table border="1">
<th ><label onClick="<%SelectedColumn="workcase_id";%>">Workcase Id</label></th>
<th><label onClick="<%SelectedColumn="status_id";%>">Status</label></th>
<tr><td>etc</td></tr>
</table>im using bean for business login, following mvc model,and i think mvc is one of good design practice to use.
<jsp:useBean id="workcaseid" scope="session"class="beanFiles.SearchWorkcaseId" />
varray = workcaseid.getWorkcaseId(Long.parseLong(MasterAccountNumber),SelectedColumn);
just tell me whether it is possible to pass javascript variable to jsp variable or not.i can do it by using hidden input type,using form and submit button. -
How can we use java variable in javascript code on JSP page?
How can we use java variable in javascript code on JSP page?
Pls helpThink about it:
JSP/Java is executed on the Server and produces HTML+JavaScript.
Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
Obviously there's no way to access a Java variable directly from JavaScript.
What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable. -
I want to assign the value of a Javascript variable to JSP Variable
I want to assign the value of a Javascript variable to JSP Variable .. for example :
<%
Bla Bla Bla
%>
<script>
var JavaScriptVariable="hello"
</script>
<%
String JSPVariable=// The Value of JavaScriptVariable ;
%>
How can i do that ??
Thanks>I want to assign the value of a Javascript variable to JSP Variable
cannot be done.Friend try to understand concepts properly Javascript is always excuted by the browser @clientside where as JSPCode is executed Websever(ServletContainer) @serverside.Through you are combining JSP Code blocks(Tags,Expressions,scriptlets...) & javascript under a single page webserver can only identify what is their under JSP Code blocks.
Hope this could be an appropriate answer for your question.
However,you can as well submit a request by encoding your URL with request parameters and the submit to the page and then collect it using request.getParameter(name).
But under a single context state it is not possible
REGARDS,
RaHuL -
Passing JavaScript values to JSP variables
Can any body correct the follwing code
<Script language="JavaScript">
function test( x )
<%
int num = x;
num = num * 2;
%>
v.value = "<%out.print(num);%>";
<input type="button" name="b" value="test" onClick="test(5)">
<input type="text" name="v" value="0">
In short, I am trying to pass JavaScript value to JSP variable. I hope that it is possible to do that. If it is possible then how can I do it. I want to assing the variable x passed to the JavaScript function called test to the JSP variable called num.
Regards,
AgeelThank you for your reply,,,
I think then the only way to do it is to post the
value on the server and then use request.getParameter
method in jsp code
but the question now how can I post values to the
server using JavaScript without reloading the pageyes... you can to it by create a new popup window which will submit the value to server after page was loaded... then, server return a value to the same window in html/jsp page which then using javascript to set it back to the opener and close up the window... however, this is not a good choice unless you have no other alternative...
>
There is other possible solution
if I can get the text field value from the same page
without reloading it that would work fine and will
solve my problem, is it possible?yes... you can get the value from the textfield...
for example :
function showValueInTextField()
alert(document.forms[0].elements["mytextfieldname"].value);
>
My final question> can jsp change things on the same
page without reloading it. I mean can it work like
JavaScript so that I can use it's internal functions
instead of using java script :S
not really know what you trying to say here... -
How can I assign javascript variables to jsp or java variables.?
How can I assign javascript variables to jsp or java variables.?
See I have generated some variables in the javascript which is on the jsp page. I want to assgin these variables to the jsp vaiables. Or how can I access javascript variables from jsp on the same jsp page.
-
Get javascript variable in JSP
Hi all,
can anybody tell me- how to get javascript variable in JSP,
in the same file (JSP).
Is this possible.
I can use JavaScript to get the value,
but then I have no way to get that to the JSP code.
Please give the appripriate answer with code.
Thanks
amitindiaHi all,
Thanks for your quick response.
So u are right that we can not call javascript variable
in the same JSP. and pass them to the bean class.
So what I did --- I get java script variable in another JSP using
request.getParameter(); and then redirected to previous JSP.
and I have solve my problem.
Actually I had to call bean class and pass varible to the bean
method but I was getting the same problem that I disscussed but now it
has been solved.
Thanks again for participation
amitindia -
Setzen Fokus �ber JavaScript im CnC-JSP-Workflow-Framework
Anleitung Setzen Fokus �ber JavaScript im CnC-JSP-Workflow-Framework
Auf der JSP-Seite muss zum Setzen des Focus auf ein
FORM-Feld folgender JavaScript-Code (hinter der Form </form>)
<script language="JavaScript" type="text/javascript">
<!--
document.forms[0].elements[ '<feld-name>' ].focus();
//-->
</script>
eingef�gt werden.
Dies wird durch das CnC-Custom-Tag
<cnc:setfocus elemName="date"/>
erledigt (siehe SetFocusTag.java).
Es benutzt entweder das optionale Attribut
elemName="date"
oder den auf dem SessionKey CNC_FOCUS hinterlegten
Form-Element-Namen, wobei der SessionKey Vorrang hat.
Nach dem Erzeugen des JavaScript-Codes l�scht das
SetFocusTag.java den Session-Wert auf dem Key
CNC_FOCUS (message consumed).
Im Fluss-Steuer-Script flow.cnc kann der Name des zu
fokussierenden Form-Elementes mit
session.CNC_FOCUS := "date";
gesetzt werden.
Bei indizierten Formularen (Tabellen) ist der Index des zu
fokussierenden Form-Elementes in eckigen Klammern mit zu
�bergeben:
session.CNC_FOCUS := "txt[" + cnc_button_index + "]";
Es d�rfen keine Leerzewichen, f�hrende Nullen oder Dezimalstellen
auftauchen.
Hier besteht eine Abh�ngigkeit zur internen Arbeitsweise des CnC-
Frameworks. Der Einfachheit wegen habe ich diese L�sung f�rs
erste gew�hlt.
Heiner Kuecker
Internet: http://www.heinerkuecker.de http://www.heiner-kuecker.de
JSP WorkFlow PageFlow Page Flow FlowControl Navigation: http://www.control-and-command.de
Expression Language Parser: http://www.heinerkuecker.de/Expression.htmlIch spreche nicht Deutch! :-P
-
Issue with JSP compilation while deploying the application in weblogoc 10.3
We are in the process of migating the struts application from oc4j to weblogic 10.3 version. The application which was running fine in oc4j is having some issues in weblogic app server , specially in case of compilaing the JSPS. We are using the same stuts jar which was used earlier. Following are the some of issues which were encounterd.
1. The method setReadonly(boolean) in the type BaseHandlerTag is not applicable for the arguments (String)
<html:text property = "operatingSetName" styleClass="textfield" readonly="<%=readOnlyStatus%>" styleId="addOPSName" onkeydown="javascript:displayLimit(this,100)" onkeyup="javascript:displayLimit(this,100)" onkeypress="javascript:displayLimit(this,100)" onmouseout="javascript:displayLimit(this,100)"/>
2.The method setDisabled(boolean) in the type BaseHandlerTag is not applicable for the arguments (String)
<html:radio property = "methodType" value = "1" styleId="fixed" disabled="<%=disableFields%>"/>
Please let me know if any weblogic specific changed to be done. we are using struts 1.2 version.
Thank you,
Srikanth.T
Edited by: 931440 on May 2, 2012 12:52 AM
Edited by: 931440 on May 2, 2012 12:53 AMThis looks to be a struts bug to me.
May be weblogic is too sensitive in reporting the error compared to OC4J
You might be able to resolve the problem, by changing the following:
Change the following taglib:
<%@ taglib uri="http://struts.apache.org/tags-html-el"; prefix="html" %>
TO
<%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html"%> {there is no 'el'}
Arun -
Including external Javascript file in JSP- not working on Mozilla Firefox
I have a JSP page which includes javascript file as below:
<script type="text/javascript" src="https://siteAddress/scripts/myJsFile.js"></script>
myJsFile.js has a method testFireFox()
There is a link on JSP which that calls this method.
<a href="#" onClick="testFireFox()">Some Text...</a>
As soon as i click on the link, nothing happens and this error appears on console:
Refrence Error: testFirefox() is not definedI tried giving the path for JS file in various ways but it did not help.
Note: This works absolutely fine in Internet Explorer.
I have not added Javascript to document.ready or onLoad event. It is simply been referred in <Head>
tag any pointers pls..This forum is intended for user support, not for web development issues.
Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The contributors over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.
Maybe you are looking for
-
I haven't been able to open ical for over a month now - getting fed up
Ever since the last update on 10.4.1.1 ical hasn't worked neither has Safari. They open for a few seconds then die. I have contacted support and had a question on here and nobody is able to help. I have followed the advice from people on here and tha
-
CFDocument - Get File Name for DB Insert
Greetings, Does anyone know how / if possible to get name of file created with the cfdocument tag for insertion into a db? <cfdocument filename="c:\inetpub\domain\ems_reporting\ file_name.pdf" Thanks Leonard B
-
Xperia Facebook integration doesn't Work
Hello, When I want to Connect my Xperia Z1 to my facebook account using Xperia Facebook integration a black Screen with loading bars appears and it stays that way indefinetely. I tried cleaning data for Xperia Facebook integration. I uninstalled face
-
How to find an include's function module
Hi all, How can we find the fm of an include? Thanks.
-
Error connecting to sensor. error loading sensor.
Hi all, I have brand new ASA 5525-X firewall and IPS Security Services Processor ( ASA5525-IPS). There is no any configuration in both devices. I try manage the both device using ASDM-IDM. I can able to access the firewall using default management IP