Problem in Javascript
Hi,
In apex versio 3.2 , I have created an item button with following fields under Button Display Attributes:
Style : Template based button
Template : Button
Attributes : onclick="javascript:check()";
Button Request Value : Reset
I have written the javascript code in HTML header under Validations in the page.
The javascript code has been executed successfully after on click of a button
But , in case of apex demo version 4.0(latest version), I have tried the same thing as above with an item button ,but I have written the javascript code in a separate JavaScript block under validations in the page. Now the page is getting submitted but the javascript is not executed.I want to know why the script is not getting executed?
Thanks,
Anoo.
Hi Peter,
As per ur suggestion i had look my HTML source page which i had found the particular line..
{a href="javascript:apex.submit('');" class="t4Button">Go{/a>. Even though when i had tried with URL i am not able to call the JS..
Could you please let me what happend or any other way to resolve my problem...
One more question is it possibe to check the source code for class t4Button, if yes means can u pls let me know the path for that!!
Thanks,
Anoo..
Edited by: Anoo on Jun 27, 2010 10:17 PM
Similar Messages
-
Problem with Javascript and opening a new page
Hi,
I'm developping a website with Java Server Faces.
I've a problem with JavaScript.
I have a table, and each row of that table, has a button, to display more information about that specific row. I want to display this information in a new window. For this I want to use JavaScript.
The new window, of course, needs some information of the other window, to show the right data.
The first time I click the 'more-information-button', it works perfectly, but from than on, he keeps showing the same information...
Here is my jsp-page of the first page (the one with the table):
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
<jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
<f:view>
<f:loadBundle basename="languages.MessageBundle" var="bundle"/>
<html>
<head>
<meta content="no-cache" http-equiv="Cache-Control"/>
<meta content="no-cache" http-equiv="Pragma"/>
<title>- UCV-Period -</title>
<link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body style="-rave-layout: grid">
<h:dataTable binding="#{UcvPeriod.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd" rows="5"
style="left: 24px; top: 168px; position: absolute" value="#{UcvPeriod.dataTable1Model}" var="currentRow">
<h:column binding="#{UcvPeriod.column1}" id="column1">
<h:outputText binding="#{UcvPeriod.outputUcvPeriod}" id="outputUcvPeriod" value="#{currentRow['UCVPERIOD']}"/>
<f:facet name="header">
<h:outputText binding="#{UcvPeriod.outputText2}" id="outputText2" value="#{bundle.ucvPeriod_columnHeader_ucvPeriod}"/>
</f:facet>
</h:column>
<h:column binding="#{UcvPeriod.column11}" id="column11">
<h:commandButton action="#{UcvPeriod.btnDetails_action}" binding="#{UcvPeriod.btnDetails}" id="btnDetails" value="+" onclick="window.open('Details.jsp')"/>
<f:facet name="header">
<h:outputText binding="#{UcvPeriod.outputText21}" id="outputText21" value=""/>
</f:facet>
</h:column>
</h:dataTable>
</h:form>
</body>
</html>
</f:view>
</jsp:root>Here is my action, when someone clicks on the 'more-information-button':
public String bthnDetails_action() {
Object s = outputUcvPeriod.getValue();
BigDecimal ucvPeriod = (BigDecimal)outputUcvPeriod.getValue();
this.getSessionBean().setUcvPeriod(new Integer(ucvPeriod.intValue());
return "detail_ucvperiod";
}Here is my constructor of the Detailspage.
public Details() {
this.txtUcvPeriod.setValue(this.getSessionBean().getUcvPeriod());
}Here is the navigation part for this part of my faces-config.xml .
<navigation-rule>
<from-view-id>/UcvPeriod.jsp</from-view-id>
<navigation-case>
<from-outcome>detail_ucvperiod</from-outcome>
<to-view-id>/UcvPeriod.jsp</to-view-id>
</navigation-case>
</navigation-rule>Thx a lot....
AnnekeSee the tutorial "Sharing Data Between Two Pages" at http://devservices.sun.com/premium/jscreator/standard/learning/tutorials/data_sharing_twopages.html and the FAQ "How can I pass data between pages without creating SessionBean variables in Creator?" at http://devservices.sun.com/premium/jscreator/standard/reference/faqs/technical/javasource/passing_data.html. Since you can open a new window when your button is clicked, the tutorial and FAQ will explain ways to pass your data to the new window.
-
Problem with JavaScript in URL iView
Hi,
I am facing a problem with javascript when i am trying to access my application through URL iView. In the javascript window.top is used to access the frames in the window. But the EP is not recognizing it as valid. what exctly the problem and please suggest me a solution.
Ashok.Hi,,
thanks for the quick reply. But what i asked was different. I will put it in different way. I have deployed a application in Web Application Server and trying to access it through URL iView. My application is pure J2EE application with html,jsp and JS files. In javascript we used window.top property of the java script which is working fine MS IE. The problem is window.top is a IE specific property which is not having any equallent open standerd so EP is throwing a java script error. As I know the only possible solution for this problem is inherating IE rendaring capabilities to iView(i.e iFrame). is there any way to do that?
Ashok. -
Hi everyone!!
The situation is this: I have a datable with one of its columns make an h:commanLink, which has two f:params, its actionListener is a function of a ManagedBean. This is JSF, not MyFaces. In IE, When the link is pressed, it shows a javascript error: " 'elements.idVar' is null or it's not an object ", however in Firefox, it works perfectly. I have been looking for the problem and it have to do with this:
</form><a href="# onclick="clearFormHiddenParams_formResultado('formResultado');document.forms['formResultado'['formResultado:_idcl'].value='formResultado:dtTablaResultados:0:_id10';document.forms['formResultado']['idVar'].value='37';document.forms['formResultado']['idMun'].value='168'; document.forms['formResultado'].submit(); return false;"><span id="formResultado:dtTablaResultados:0:itColumna3" title="AREA COSECHADA EN CULTIVOS PERMANENTES">1,230</span></a></td>
</tr>
<tr class="standardTable_Row2">
<td><span id="formResultado:dtTablaResultados:1:itColumna1" style="text-align:center;" title="Código Municipio">718</span></td>
<td><a href="javascript:void(0)" onclick="javascript:window.opener.opener.showLink('SASAIMA')"><span id="formResultado:dtTablaResultados:1:itColumna2_l" title="Municipio">SASAIMA</span></a></td>
<td><form id="formResultado:dtTablaResultados:1:_id9" method="post" action="/ConsultaEstadisticasGeo/resultadoConsulta.jsf" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="com.sun.faces.VIEW" id="com.sun.faces.VIEW" value="_id39:_id41" /><input type="hidden" name="formResultado:dtTablaResultados:1:_id9" value="formResultado:dtTablaResultados:1:_id9" /><input type="hidden" name="idVar" /><input type="hidden" name="idMun" /><input type="hidden" name="formResultado:_idcl" />
<script type="text/javascript">
<!--
function clearFormHiddenParams_formResultado_dtTablaResultados_1__id9(curFormName) {
var curForm = document.forms[curFormName];
curForm.elements['idVar'].value = null;
curForm.elements['idMun'].value = null;
curForm.elements['formResultado:_idcl'].value = null;
//-->
</script>
the way JSF manage the params. The error, acdording to the message shonw by IE is in this line: curForm.elements['idVar'].value = null;
The code of the JSP is this:
<h:commandLink actionListener="#{consultaEstadisticasMB.detalleEstadistica}">
<f:param name="idVar" value="#{consultaEstadisticasMB.idColumna3}" id="idVar" />
<f:param name="idMun" value="#{registro[0]}" id="idMun" />
<h:outputText title="#{consultaEstadisticasMB.columna3}" id="itColumna3" value="#{registro[2]}" />
</h:commandLink>
Waht can i do? (Not using MyFaces, because I can�t do that)
Thanks for your answers!!I have run into this same problem with javascript and the colon. I am not sure if the colon is a valid character for a javascript identifier (one would think the RI developers would have checked it out though!?!).
Anyway, my workaround is to search through the Javascript DOM for the widget you want to obtain a reference to, using part of its id. After all, you know its id, you just can't use it as a javascript reference. In your Javascript code, do something like:
var inputWidgets = document.getElementsByTagName("input");
var targetInput;
for(var i = 0; i < inputWidgets.length; i++)
var inputId = inputWidgets.id;
if(inputId.indexOf("yourInputId") != -1)
targetInput = inputWidgets[i];
break;
It's a lot of effort to just get a reference to a form widget....but it works (I pasted in the code and changed it a bit, so it might not work as is, but at least it demonstrates the idea). -
Webcontrol problems with javascript
Hello,
the page I want to navigate making me problems in my webcontrol. The same page works fine if I go there manually with the Internet Explorer. I force webcontrol to use another IE version than default. I changed regedit >
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
and a new key for my application with value 2af8(11000)
If I do not force this version the used version in the webcontrol seems to be to old.
I think that my application does not use the settings of my IE because if I use IE manually it works.
I used Google and I can not find a property to force the webcontrol to activate javascript - it seems that I have to change this by the "global" settings.
Edit: I do not exactly know if its javascript. The error is a script error.
It does not help to suppress this errors - the page is not working correctlyHello,
in the meantime I tried GeckoFX to solve the issue, but I get another problem later so I come back to the native webcontrol. To get help I will translate the error message because I can not attach a screenshot
"Scripterror
URL: http://www.transerv2000.de/DesktopModules/SNITNET_Metrix/js/rma_main.js
Do you want to continue? Yes / No"
Because I see the .js I think that this is an issue because of javascript.
If I navigate to this site and do some work I have no problems. This is why I think that the used IE in my webcontrol is having other settings?!
Please help and thanks alot.
Edit: If I supress javascript errors, I got not Messagebox but the content dont work - so I really think that it is a problem with javascript. As I said, if I use the IE as application the page works fine. -
Dialog Error Box reads:
A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.
Script: http://www.classictesla.com/java/javatc/script/JTC_geotc.js:1299
The above dialog has never come up before. This program ran fine forever and has not changed. With Firefox 8, the program ran in 0.3 seconds. IMMEDIATELY as I allowed the browser to upgrade to 9.0.1, the program is now not working.
About 1000 people use this program. Knowing how slow fixes can be, I have to inform them not to allow FF to upgrade to version 9. Really sucks as I've been a FF fan forever.
If you go to that website, click the "Load Sample Coil" button, then scroll down and click the RUN JAVATC button, you'll see the problem
If there is a problem with the script, why only now after so many years of running? I can run it just fine on version 8. If there's something I can do on my end, I would love to (just tell me what the problem is).
My guess = "version 9 is limiting the number of iterations a script can run". This code use to run in 0.3 seconds and now is just hung. A very sad day for me. I guess I have to figure out how to go back to old version 8.Only Firefox 9 seems to have that problem. Firefox 8 and Firefox 10 (beta) and later work. It helps a bit if I disable javascript.options.methodjit.content, but then it still takes 4 seconds compared to 0.2 or 0.3 seconds with the other Firefox versions. So that looks like a bug with the JIT compiler.
-
Problem with Javascript in JSP
Hi Guys,
I have this problem with my JSP page. I am using a javascript function
which calls a function within a bean. The problem that I have is that I get an error when trying to call the following function :
function refDataTypes_onchange()
Vector empNames = DBQuery.getResult();
I get a runtime error at the line Vector empNames = DBQuery.getResult;
Any ideas would be much appreciated.
Below is the whole code:
Thanks in advance
FRank
<%@ page contentType="text/html;charset=WINDOWS-1252"%>
<%@ page import="java.util.*, java.lang.*" %>
<%-- Declare the java bean for the countries to be queried --%>
<jsp:useBean id="DBQuery" class="DBQuery" scope="page" />
<%-- Bean property searchCondition is not set to query countries --%>
<jsp:setProperty name="DBQuery" property="searchCondition" />
<%
Vector empNames = DBQuery.getResult();
%>
<HTML>
<BODY BGCOLOR="GREY">
<SCRIPT LANGUAGE="JavaScript1.1">
function refDataTypes_onchange()
Vector empNames = DBQuery.getResult();
</SCRIPT>
<FORM NAME = form1>
Please enter in the following details
<p>
Reference Type :::====
<select name="refDataTypes" onchange="refDataTypes_onchange()">
<option value ="1"></option>
<% for(Enumeration enum = empNames.elements();enum.hasMoreElements();)
String nextEmpName = (String)enum.nextElement();
%>
<option value =<%=nextEmpName%>><%=nextEmpName%></option>
<%
%>
</select>
<BR>
<BR>
Emp No
<INPUT TYPE="text" NAME=txtAge >
<BR>
<BR>
<INPUT TYPE="button" VALUE="Check Details" NAME=butCheckForm >
</FORM>
</BODY>
</HTML>Thanks dimadoo
I need my JSP to do the following :
When a user selects a option from a select list. There is a textfield which I want to populate based on the option that thas been selected from the list.
I tried the following :
<% Vector empNames = DBQuery.getResult(); %>
and it does not even go into the bean.
Will this work if I refresh the page? -
Problem with JavaScript getPageNumWords
Using AR7.0.9. I have a problem with the JavaScript method doc.getPageNumWords and the associated machinery for keeping
track of the words on a page. And I'm wondering if it's a bug,
or something which is not properly defined by the PDF spec.
The situation is illustrated by the test file:
http://www.amrita-cfd.org/4adobe/word-count/test1.pdf
It would appear that the word machinery is aware of
the text in the /Xform's used by /Widget annotations.
But the text is locked in the first time the
machinery is activated on a page i.e. visible /Widget's
are included and invisible ones are ignored.
But since /Widget's can be turned on and off
it's then possible for the word-cache to become out of sync
with respect to the visible text on the page.
Note that a widget which is invisible when
the document is opened, but visible when
doc.getPageNumWords is first called is included
in the word list i.e. the word-cache is computed
once in a just-in-time fashion.
Is the above a known problem, or an inconsistency that has
not been considered before? One solution would be
to add an optional parameter to getPageNumWords
that would force the word-cache to be recomputed,
when needed. Thus removing the need to keep automatic
track of which widgets to include and exclude.
James QuirkStart Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes -
Hi,
I am using following htl in my jsp.
<INPUT type=CHECKBOX name='markets' value='911|6' >
I am using the following javascript in on submit event
alert(document.form.markets.length );But i am getting "undefined" in my alert box.However if there are more such checkboxes named market...i am getting the length as output.
what may be the problem?
Thanks
Viveki tried this and its working fine:
alert(document.forms[0].markets.length );
<form>
<INPUT type=CHECKBOX name='markets' value='911|6' >
<INPUT type=CHECKBOX name='markets' value='911|6' >
<INPUT type=CHECKBOX name='markets' value='911|6' >
<INPUT type=CHECKBOX name='markets' value='911|6' >
<INPUT type=CHECKBOX name='markets' value='911|6' >
<INPUT type=CHECKBOX name='markets' value='911|6' >
</form> -
Problem with JavaScript snipet that DreamWeaver is writing
I am having a problem with code that DreamWeaver (CS3) is
writing. I'm fairly certain the problem is in a small piece of
JavaScript that DreamWeaver is composing.
This is a fairly complex problem, so bear with me.
First - What I am trying to make happen: When on a page on my
site (the-oilman.com) I want a link that opens a new window in the
on-line store at a different site (AMSOIL.com). I need to leave
both the page on my site open and have this 'store' page open.
First of all this is working fine, using the 'Open Window'
'behavior' in DreamWeaver. If someone wants to change windows (or
tabs) and go back to my page, leaving the 'store' window open also
- the problem is set up to happen. If from back at my site, you
click on the same or a different link that goes back to the 'store'
either on the same page or a different page at AMSOIL.com - the
'store' window goes to the correct page, but the 'store' window
does NOT come on top. When they click on a link to go back to the
'store' I need the 'store' window to come to the top. If they have
previously put something in the cart, and come back and add
something else to the cart in the 'store' by coming in from
different links on my site the 'store' is working correctly because
I leave it open the whole time.
snipets of code that DreamWeaver is writing for my site
(the-oilman.com):
from the head:
<script>
<!--
CSAct[/*CMP*/ '129AABC1'] = new Array(CSOpenWindow,/*URL*/ '
http://www.amsoil.com/redirect.cgi?zo=52257&page=store','store',0,0,true,true,true,true,tr ue,true,true);
CSAct[/*CMP*/ '129AAC63'] = new Array(CSOpenWindow,/*URL*/ '
http://www.amsoil.com/redirect.cgi?zo=52257&page=store','store',0,0,true,true,true,true,tr ue,true,true);
CSAct[/*CMP*/ '10D39F40'] = new Array(CSOpenWindow,/*URL*/ '
http://www.amsoil.com/redirect.cgi?zo=52257&page=storefront/sso','store',0,0,true,true,tru e,true,true,true,true);
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
//-->
</script>
code from 2 different links that is using this script:
<a href="
http://www.amsoil.com/redirect.cgi?zo=52257&page=storefront/sso"
target="store" onClick="MM_openBrWindow('#','store','')"
csclick="10D39F40">Buy Now</a>
<a href="
http://www.amsoil.com/redirect.cgi?zo=52257&page=store"
title="AMSOIL Store at AMSOIL.com" target="store"
onClick="MM_openBrWindow('http:www.amsoil.com/redirect.cgi?zo=52257&page=store','stor e','')">On
Line Store</a>
I believe what I need is a longer javascript. Instead of just
"window.open" I need an "if" but my javascript knowledge is very,
very limited.
I need it to first check that if the window named 'store' is
open then 'focus' it, or if it is not open to open the window named
'store'.
Will this fix my problem? If so, please help me write the
lines of code to do it.
If this isn't the solution, what is the problem and the
solution?
A separate question but related: if you look in the two
different links codes, in the function call one of them uses a
'null' page reference and the other repeats the full link reference
from the href= . Both seem to work, but which is the correct or the
preferred syntax. My guess is there are some browsers that this
will give a problem, but which way is preferred.
Don Dawson
mailto:[email protected]Create a new page. Try to apply this same behavior to a link
on that new
page. Look at the code. Can you reproduce the problem there?
The code you
show below has oodles of GL stuff in it. Do you need that GL
markup?
What operational sequence did you go through to get this
behavior call?
onClick="MM_openBrWindow('#','store','')"
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"pad graphics" <[email protected]> wrote in
message
news:[email protected]...
>I am having a problem with code that DreamWeaver (CS3) is
writing. I'm
>fairly
> certain the problem is in a small piece of JavaScript
that DreamWeaver is
> composing.
>
> This is a fairly complex problem, so bear with me.
>
> First - What I am trying to make happen: When on a page
on my site
> (the-oilman.com) I want a link that opens a new window
in the on-line
> store at
> a different site (AMSOIL.com). I need to leave both the
page on my site
> open
> and have this 'store' page open. First of all this is
working fine, using
> the
> 'Open Window' 'behavior' in DreamWeaver. If someone
wants to change
> windows (or
> tabs) and go back to my page, leaving the 'store' window
open also - the
> problem is set up to happen. If from back at my site,
you click on the
> same or
> a different link that goes back to the 'store' either on
the same page or
> a
> different page at AMSOIL.com - the 'store' window goes
to the correct
> page, but
> the 'store' window does NOT come on top. When they click
on a link to go
> back
> to the 'store' I need the 'store' window to come to the
top. If they have
> previously put something in the cart, and come back and
add something else
> to
> the cart in the 'store' by coming in from different
links on my site the
> 'store' is working correctly because I leave it open the
whole time.
>
> snipets of code that DreamWeaver is writing for my site
(the-oilman.com):
> from the head:
> <script>
> <!--
> CSAct[/*CMP*/ '129AABC1'] = new
Array(CSOpenWindow,/*URL*/
> '
http://www.amsoil.com/redirect.cgi?zo=52257&page=store','store',0,0,true,true,t
> rue,true,true,true,true);
> CSAct[/*CMP*/ '129AAC63'] = new
Array(CSOpenWindow,/*URL*/
> '
http://www.amsoil.com/redirect.cgi?zo=52257&page=store','store',0,0,true,true,t
> rue,true,true,true,true);
> CSAct[/*CMP*/ '10D39F40'] = new
Array(CSOpenWindow,/*URL*/
> '
http://www.amsoil.com/redirect.cgi?zo=52257&page=storefront/sso','store',0,0,tr
> ue,true,true,true,true,true,true);
> /
> function MM_openBrWindow(theURL,winName,features) {
//v2.0
> window.open(theURL,winName,features);
> }
> //-->
> </script>
>
> code from 2 different links that is using this script:
> <a href="
http://www.amsoil.com/redirect.cgi?zo=52257&page=storefront/sso"
> target="store" onClick="MM_openBrWindow('#','store','')"
> csclick="10D39F40">Buy
> Now</a>
> <a href="
http://www.amsoil.com/redirect.cgi?zo=52257&page=store"
> title="AMSOIL
> Store at AMSOIL.com" target="store"
>
onClick="MM_openBrWindow('http:www.amsoil.com/redirect.cgi?zo=52257&page=sto
> re','store','')">On Line Store</a>
>
> I believe what I need is a longer javascript. Instead of
just
> "window.open" I
> need an "if" but my javascript knowledge is very, very
limited.
> I need it to first check that if the window named
'store' is open then
> 'focus'
> it, or if it is not open to open the window named
'store'.
> Will this fix my problem? If so, please help me write
the lines of code to
> do
> it.
> If this isn't the solution, what is the problem and the
solution?
>
> A separate question but related: if you look in the two
different links
> codes,
> in the function call one of them uses a 'null' page
reference and the
> other
> repeats the full link reference from the href= . Both
seem to work, but
> which
> is the correct or the preferred syntax. My guess is
there are some
> browsers
> that this will give a problem, but which way is
preferred.
>
> Don Dawson
> mailto:[email protected]
> -
Problem with javascript/PHP/ oracle 10g smart quotes
I have a problem with my php form that passes the text field to a javascript object. When I copy text from MS Word that includes smart quotes, the form inputs that into the database as ? (upside down) marks. The charset of the DB is WE8MSWIN1252. How do I store these smart quotes as regular quotes? And also if I can do any conversions on the front end (js or php). I tried doing some conversion but to no avail. Any help would be appreciated thank you. “double”
Decide if you want your HTML pages in Windows code page 1252 or Unicode UTF-8. Then, make sure the pages are properly tagged as either "text/html;charset=windows-1252" or "text/html;charset=utf-8". Use HTTP header Content-type or the corresponding <META HTTP-EQUIV=...> tag. Then, set NLS_LANG environment variable for your PHP engine to either AMERICAN_AMERICA.WE8MSWIN1252 or to AMERICAN_AMERICA.AL32UTF8, depending on which encoding you selected for your HTML.
-- Sergiusz -
Problem with javascript cookies and frames in Safari
I have a web page with 2 frames in it. One frame holds a pulldown menu for quick navigation, which changes the content in the other frame and also writes a cookie that makes that choice the default when the user comes back to the web page. My problem is that when the page that has the navigation is in frames it will not change the cookie when the navigation choice is changed. It will only change the cookie if the navigation page is displayed on its own web page (not in frames). The javascript works fine in both FireFox and Google Chrome. It's only Safari that has this problem. Is this a bug in Safari, or do I need to code this differently? I also tried putting the javascript function in the main index.html page that sets up the frames, but that didn't help either.
HI Patrick,
Try posting in the Apple Technoligies forums here.
http://discussions.apple.com/forum.jspa?forumID=735
Carolyn -
Problem with javascript confirm() in a JSP
I'm trying to use a confirm() box in a jsp. I've looked at tons of examples and I still have the same problem. If I just add this to my page the prompt will pop up as expected: (of course it doesn't really do anything.)<SCRIPT LANGUAGE="JavaScript">
confirm( "Are you sure you want to delete?" )
</SCRIPT>As soon as I add an if clause around it it doesn't even pop up anymore, such as:if (confirm("Are you sure you want to delete?")){
<%
Do some jsp stuff
%>
else {
<%
Do some jsp stuff
%>
}I can include more of the code if needed. This code is for deleting some files, so I want to add an "are you sure prompt?". If they hit ok it will delete, otherwise cancel the operation.
I assume that the "if confirm( "Are you sure you want to delete?" ) " should wait for a reponse before continuing. Any help is appreciated.
Thanks,
JamesYou can use Javascript to confirm a delete, and delete an object in the following manner.
//link to delete an object..
<a href="thisPage.jsp?delete=<%= itemID %>"
onClick="return confirm('Are you sure you wish to delete this item?');">delete</a>Then, at the top of the JSP pageif(request.getParameter("delete") != null)
//do whatever to delete, then load the page as normal
}Now, your item will be deleted, and the page will be refreshed to show the changes. -
Problem with JavaScript code in Page Attributes, modal popup...
Hello all!
I'm encountering a problem with a modal popup I wrote in JavaScript.
h3.
The situation*
A user sees an interactive report with rows that are clickable, so these rows are links. Upon clicking the name of something in a row, some items get a certain value and a modal popup shows on the screen. In this modal popup, there are details regarding that particular row the user has clicked, but the problem_ here is...
The modal popup closes itself only seconds after it has been opened.
This must be because I've probably made a mistake somewhere in my code, but I just can't figure out where... It also appears that when I click on a row link, the popup shows, but the progress bar of my toolbar seems to show a loading bar (as if I refreshed the page).
h3.
My code*
This code is located in the _"Function and Global Variable Declaration"_ part, under the _"JavaScript"_ tab. Code is in the _"Page Attributes"_ of my page 24.
function showhide(x){
$x('REGION1').style.display = ( x == 'REGION1') ? 'block' : 'none';
$x('REGION2').style.display = ( x == 'REGION2') ? 'block' : 'none';
$x('REGION3').style.display = ( x == 'REGION3') ? 'block' : 'none';
$( function(){
$('#ModalForm').dialog(
modal: true,
autoOpen: false,
width: 500,
height: 350,
buttons:{ Close: function(){closeForm();}
function openForm()
$('#ModalForm').dialog('open');
function closeForm()
$('#ModalForm').dialog('close');
$(document).ready(function() {
$('a.temppop').click(function() {
openForm();
});This code is located in the _"Header Text"_ part, under the _"Header"_ tab. Code is in the _"Page Attributes"_ of my page 24.
<link rel="stylesheet" href = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"> </script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"> </script>This code is located in the _"Column Link"_ part, you get there by going to the _"Report Attributes"_ of the region called _"Template overview"_ on page 24. This region is an interactive report.
Link Text: #FOODTEMPLATENAME#
Link Attributes: class="temppop"
Target: Page in this Application
Page: 24
Item 1, name: P24_MEALID; item 1, value: #MEALTYPEID#
Item 2, name: P24_TEMPLATEID; item 2, value: #FOODTEMPLATEID#So basically I call the function to open the modal popup by the class name. When a link with that class name in it is clicked, it opens the popup.
To remind you of the problem, the modal popup closes seconds after it has been opened. How do I fix this?
Thanks in advance.
(APEX version 4.1.1.00.23)Come on guys... I really need to know this. :(
-
Problem with Javascript form submission
Would someone correct the following the Javascript function?
It should submit the form when test==true, and should give an alert message
when test==false.
The problem is when the alert message is displayed and closed, the form is still submitted.
In fact, I need no action when an alert message is closed.
Thank you.
<script type='text/javascript'>
function submitForm(en){
var test =true;//true means form is valid and ready for submission.
if(en == "submit_btn"){
var alertMessage =null;
if(myform.choice01.selectedIndex==0 && myform.choice02.selectedIndex==0 ){
test=false;
alertMessage ="ERROR1";
if(myform.category.selectedIndex==0){test = false; alertMessage="ERROR2";}
if(myform.left_right.selectedIndex==0){test = false; alertMessage="ERROR3";}
if(test==false) {alert(alertMessage); return true;}//dont submit
else if(test==true){//submit form
var submitURL= "someURL";
myform.action = submitURL;
myform.submit();
}//end else if
}//end function
</script>Try This
<FORM name="myform" method="POST" >
<SELECT name="category" onchange="submitForm(this.name)";>
//<Option> elements
<SELECT name="left_right" onchange="submitForm(this.name)";>
//<Option> elements
// and more <SELECT> elements
<INPUT type=submit name=submit_btn value="submit" onclick="submitForm(this.name)";>
</form>
<script type='text/javascript'>
function submitForm(en)
myform = document.forms(0);
var isValidRequest = true;//true means form is valid and ready for submission.
if(en == "submit_btn")
var alertMessage =null;
if(myform.choice01.selectedIndex==0 && myform.choice02.selectedIndex==0 )
isValidRequest=false;
alertMessage ="ERROR1";
if(myform.category.selectedIndex==0)
isValidRequest = false;
alertMessage="ERROR2";
if(myform.left_right.selectedIndex==0)
isValidRequest = false;
alertMessage="ERROR3";
if(isValidRequest)
//submit form
var submitURL= "someURL";
myform.action = submitURL;
myform.submit();
}//dont submit
else
alert(alertMessage);
}//end else
}//end function
</script> -
Problem with javascript in Firefox
Hi,
In my JSP I call a Javascript function when a radio button is selected and it works fine if I use IE, When I use firefox I get the following error
Error: document[getNetuiTagName(formId)] has no properties
Source File: http://gio5wl06.mt.att.com:11100/frSvc/frAtmSvc/gotosalesOrder.do
Line: 193
This is my javascript function
function showLayer(formId, tagId) {
//alert("showLayer");
//alert("formId " + formId);
//alert("tagId " + tagId);
if (tagId == "abnDataId") {
//alert("In abnDataId");
document[getNetuiTagName(formId)][getNetuiTagName("cwmProcessId")].disabled = false;
if (tagId == "corrId") {
document[getNetuiTagName(formId)][getNetuiTagName("corrTypeId")].style.visibility="visible";
document.getElementById("corrTypeLablId").style.visibility="visible";
I have no idea what the problem is?
DhrubaHello!
first of all i don't speek english so i just try to write well but i don't guarantee about the results...
Now, the problem is that you use the 2 dimension array in the code
document[getNetuiTagName(formId)][getNetuiTagName("cwmProcessId")].disabled = false;
If you use this alternative code:
var inst = document.getElementById(getNetuiTagName("cwmProcessId");
inst.disabled = false;
or
var inst = document.getElementById(getNetuiTagName("cwmProcessId",this);
inst.disabled = false;
you can see that your code work well either in firefox than in explorer!
Try and enjoy!
Bye!
Marco
Maybe you are looking for
-
Adobe creative cloud is installed, but will not run
, adobe creative cloud is installed legally., but will not run
-
Problem with Mavericks 10.9.1 e Java Se 7 u 45
Java SE 7 no longer works. Message in console: 07/01/14 10:59:09,221 java[1172]: objc[1172]: Class JavaLaunchHelper is implemented in both /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java and /Library/Internet Plug-Ins/JavaAp
-
What can I do about the hackers in my devices.
What can I do about the hackers in my devices. Pls help i need to know what I can do to take the hackers out of my devices.
-
Hi Apex Experts, I am having application 101(SALES) with APEX 4.2.2, for the same i have configured SSO with clean URL, but when user logged into application it is showing the edit mode URL (Dirty URL). Ex:- Clean URL = https://forums.oracle.com but
-
Hey guys, What's up?! I'm just wondering if I could change my alarm tone to my own mp3? Thanks people!