Javascript combining onmouseover & onclick
Hi all! I'm basically new to javascript & here's my problem: I've got a row of image thumbnails. As of now, when I do a rollover, the larger image displays in a different div & then onmouseout it goes away. That works fine, but I'd like to add an option to click on the thumbnail & have the larger image stay displayed, regardless of the onmouseout, until another thumbnail is rolledover. Any ideas, help, etc would be very much appreciated! Here are my .css, javascript, & html:
<style type="text/css">
#Style1 {
position:absolute;
visibility:hidden;
border:solid 05px #000;
background-color:#000;
color:#999;
font-family: "Times New Roman", Times, serif;
font-size: 14px;
font-weight: bold;
#Style2 {
position:absolute;
visibility:hidden;
border:solid 5px #000;
background-color:#000;
color:#999;
font-family: "Times New Roman", Times, serif;
font-size: 14px;
font-weight: bold;
#Style3 {
position:absolute;
visibility:hidden;
border:solid 5px #000;
background-color:#000;
color:#999;
font-family: "Times New Roman", Times, serif;
font-size: 14px;
font-weight: bold;
</style>
<script type="text/javascript" >
<!--
function ShowPicture(id,Source) {
if (Source=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
else
if (Source=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
</script>
<div style="position:absolute; left:500px; top:150px;">
<a id="Style1"><img src="images/photos/image01.gif" />Image #01</a>
<a id="Style2"><img src="images/photos/image02.gif" />Image #02</a>
<a id="Style3"><img src="images/photos/image03.gif" />Image #03</a></div>
<div style="position:absolute; left:323px; top: 150px;">
<li><img src="images/photos/image01.gif" width="50" height="75" hspace="24" class="thumbnails" onMouseOver=" ShowPicture('Style1',1)" onMouseOut="ShowPicture('Style1',0)" /></li>
<li><img src="images/photos/image02.gif" width="50" height="75" hspace="24" class="thumbnails" onMouseOver=" ShowPicture('Style2',1)"onMouseOut="ShowPicture('Style2',0)"/></li>
<li><img src="images/photos/image03.gif" width="50" height="75" hspace="24" class="thumbnails" onMouseOver=" ShowPicture('Style3',1)" onMouseOut="ShowPicture('Style3',0)"/></li></div>
Thanks a lot! Any help is very much appreciated!!!
Hi
Use a separate event listener for the click event to display the the image, see - https://developer.mozilla.org/en/DOM/element.addEventListener.
However IE8 and below uses a none standard even listener called attatchEvent, (see - http://msdn.microsoft.com/en-us/library/ms536343%28v=vs.85%29.aspx ) so your code should look something similar to -
if(window.addEventListener)
theObj.addEventListener("click", function(){alert("addEventListener");}, false);
else if(window.attachEvent)
IE9+ does support the standard addEvenListener.
There is an excellent description of using the event model in - http://www.amazon.co.uk/JavaScript-Definitive-Guide-Guides/dp/0596805527/ref=dp_ob_title_b k, which is almost an essential if you wish to use JavaScript, even though the book is more a reference for JavaScript it does contain a few good tutorials and contains sections on the newer html5 features and ecmascript 5.
PZ.
Similar Messages
-
Javascript Submit button onclick event handler
Hi,
I am having trouble getting the onclick event handler of a form to execute when the button is pressed. I am trying to open a page in a new window depending on if the user selects that option in a checkbox.
There is one form(id='graphform') and 2 submit buttons, each with a checkbox before it. I want the new window to open only iuf the right checkbox and matching submit button has been checked.
One of the checkbox/button pair: The onclick="checkWindow('w1','graphform');" is never getting called.
<input type="checkbox" id="w1" name="win1" style="margin-right: 10px" value="window" onclick="javascript:document.gform.win1[0].checked = true;"><a style="margin-right: 10px">Graph in new window</a>
<input type="submit" value="Create graph" onmouseover="this.form.cumulat.value='0';this.form.graphGroup.value='Consumption'; document.getElementById('hintSubmitStop').value='1';" onclick="checkWindow('w1','graphform');" onmouseout="document.getElementById('hintSubmitStop').value='0';" /></td></tr>Javascript window opener:
function checkWindow(win1, str){
var formObj = document.getElementById(str);
var checkBoxObj = document.getElementById(win1);
if(checkBoxObj1.checked == true){
formObj.target = "_blank";
formObj.action = "graphDisplayFrame.jsp";
else if(checkBoxObj1.checked == false){
formObj.target = "_self";
formObj.action = "graphDisplay.jsp";
}Any suggestions?
JYou're storing the value in "checkBoxObj" and in the next line you use different variable name as "checkBoxObj1".
var checkBoxObj = document.getElementById(win1);
if(checkBoxObj1.checked == true){
instead of "true', try if(checkBoxObj.checked == 1){ -
Any solution to javascript/css menu 'onclick' issue in ios 5.0.1?
I'm a web designer with an issue that seems widespread - but I can't find an solution anywhere online.
Our web site menus worked well in older ios versions - one tap on the main image of a drop-down triggered a rollover & the mouseover behavior and opened the menu, another click or two selected the submenu.
Now, since ios 5, one tap on the main image activates the onclick behavior for that image (actually on the div containing the menu), and launches the url. They work as desired without the onclick. Tried rebooting and clearing caches & data. Happens on ipad/ipod.
I'm prepared to use a different method to write these (jquery, superfish, p7 Magic Menu 2) but I can save lots of time if there's a fix our code that would work.
Anyone solve this yet? No luck trying to use focus, hover or dblclick on the main image.
Here's the sample:
http://net.acpe.org/menufix/menu-home.htmSolved with this fix posted by Mark Goddard.
http://blog.0100.tv/2010/05/fixing-the-hover-event-on-the-ipadiphoneipod/
I also think it was an update to Mobile Safari that is causing this, not the ios 5 update. -
Another Javascript issue (CheckBox onClick event)
Hello All,
I am using NWDS04s Adobe Designer 7.1.
I created a IF with a TextField on it and a CheckBox. What i would like to do is, when the checkbox is checked, the TextField should disappear (TextField1.Presence = "hidden").
I wrote this script in the OnClick event of the Checkbox:
if (CheckBox1.rawValue == "1") {
TextField1.presence = "hidden";
}else {
TextField1.presence = "visible";
When i deploy my WD you could guess, it's not working ;-((
Is there something i am doing wrong??
When i place this code in the Initialize event of the CheckBox and change the If statement to CheckBox1.rawValue == "0" it works as expected.
Hope somebody can help me or try it on there machines. Maybe it's a bug.
Thx in advance.
Kind Regards,
MaartenHello Maarten,
Please have a look at method <a href="https://media.sdn.sap.com/javadocs/NW04s/SPS7/wd/com/sap/tc/webdynpro/clientserver/adobe/pdfdocument/api/IWDPDFDocumentInteractiveFormContext.html#setDynamic(boolean)">setDynamic</a> (interface IWDPDFDocumentInteractiveFormContext).
Regards,
Philipp -
Javascript to JSP question...Can javascript function set session attributes
hello,
i have a web app that, on one of its pages, displays "tabbed pane" as an image map at the top (a la amazon.com). my problem is this: each "logical" page contains separate forms that all use the same javabean. in other words, imagine that the tabs represent an account maintenance web ui for an on-line record store. the first tab might be labeled "General," the second "Contact info," the third "Shipping Info." Each uses the same account bean and displays portions of its properties relevant to the tab at hand. what i want to do is allow a user to enter the account maintenance ui, update info on the first tab, click on tab two and have the request with the changes sent to a processing jsp. yet, since each "tab" is actually a separate URL to another page, how do i get the updated info on the first tabe without adding some sort of "SAVE" button on each tab. ive considered using javascript, but dont know how to get the request params out of the first tab whn i click on another tab. is it possible to include an "onClick" function in each URL that "grabs" the updated form fields off the preceeding tab? can a javacript function set session attributes in jsp?hello there,
wow, you've created one big mammy-jammy tool.
first, javascript cannot access, set values to the session, without having to post to another JSP. javascript is great for manipulating objects, layers, form values, etc.
you have 2 issues [if i understand correctly]:
1) you need to able to save user info for a specific tab without having to reloading the page.
---you can create a form for EACH of your tabs and POST all the information to a hidden IFRAME or LAYER for NN4. that hidden IFRAME / LAYER will load a JSP page which with all the parameters you posted to it. or you can build a FRAMESET and target that document["frame-name"].src with that same JSP.
2) handling when the SAVE INFO action should happen: hence some javascript event handler: onMouseOver, onClick, etc
---i don't know the dynamics of your tabs, but if store which tab was clicked on last, then if the user clicks on some other tab, javascript can submit that FORM to a JSP [see condition above]
you have an interesting tool. can i see?
i hope i wasn't too confusing, but your problem is sooo interesting. =)
-WJP -
Hello
I have an image link and it works just fine
but...... I also need to have the other onclick executed at
the same time.
how best should I do this.
<img src="images/fp_pic.jpg" alt="Elbow" width="132"
height="101"
onclick="P7_EPMctl('p7EPMtrg2_1','trigger')">
<a href="javascript:void(0);"
onclick="play();">Play</a>
i do no longer need the word play in the above link, i need
to combine both
to work with one onclick event.
regards
kTwocans wrote:
> i do no longer need the word play in the above link, i
need to combine both
> to work with one onclick event.
Separate the function calls with a semicolon:
<img src="images/fp_pic.jpg" alt="Elbow" width="132"
height="101"
onclick="P7_EPMctl('p7EPMtrg2_1','trigger');play()">
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS4",
"PHP Solutions" & "PHP Object-Oriented Solutions"
http://foundationphp.com/ -
Validation errors javascript navigation bar
I created a navigation bar using Dreamweaver CS3 wizard. I
got several error messages. After I replaced all the uppercase
letters with lower case, I had only one error message. I know
nothing about javascript and I may have messed something up.
Dreamweaver put the navigation bar in a table. I got rid of the
table and put it in div tags. I also moved the part that goes in
the head to an external sheet. Here is coding from the page:
quote:
<div id="mainNav">
<div class="buttons"> <a href="#" target="_top"
onClick="MM_nbGroup('down','group1','home','images/buttons/home2.jpg',1)"
onMouseOver="MM_nbGroup('over','home','images/buttons/home2.jpg','',1)"
onMouseOut="MM_nbGroup('out')"><img name="home"
src="images/buttons/home2.jpg" border="0" alt=""
onLoad="MM_nbGroup('init','group1','home','images/buttons/home1.jpg',1)"
/></a> </div>
<div class="buttons"> <a href="javascript:;"
target="_top"
onClick="MM_nbGroup('down','group1','About','images/buttons/about2.jpg',1)"
onMouseOver="MM_nbGroup('over','About','images/buttons/about2.jpg','',1)"
onMouseOut="MM_nbGroup('out')"><img name="About"
src="images/buttons/about1.jpg" border="0" alt="" onLoad=""
/></a></div>
<div class="buttons"> <a href="javascript:;"
target="_top"
onClick="MM_nbGroup('down','group1','support','images/buttons/support2.jpg',1)"
onMouseOver="MM_nbGroup('over','support','images/buttons/support2.jpg','',1)"
onMouseOut="MM_nbGroup('out')"><img name="support"
src="images/buttons/support1.jpg" border="0" alt="#" onLoad=""
/></a> </div>
<div class="buttons"> <a href="javascript:;"
target="_top"
onClick="MM_nbGroup('down','group1','contact','images/buttons/contaqct2.jpg',1)"
onMouseOver="MM_nbGroup('over','contact','images/buttons/contaqct2.jpg','',1)"
onMouseOut="MM_nbGroup('out')"><img name="contact"
src="images/buttons/contact1.jpg" border="0" alt="" onLoad=""
/></a></div>
</div>
<!--mainNav-->
And the error messages:
quote:
Line 33, Column 302: there is no attribute "onload".
…/home2.jpg" border="0" alt=""
onload="MM_nbGroup('init','group1','home','imag
/Q]
If I may throw another javascript question in.... Dreamweaver
threw something into the body tag that appears to be preloading the
images
"<body
onload="MM_preloadImages('images/buttons/about2.jpg','images/buttons/support2.jpg','image s/buttons/contaqct2.jpg','../images/buttons/home1.jpg','../images/buttons/home2.jpg')">"
Can this be moved to the external sheet or is this the same
thing which is in the external sheet:
"function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new
Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a
.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
Thanks.> I have a complex navigation bar created using
> javascript.
It should only take you a few weeks to discover what a bad
idea this is,
then.
> I need to make sure the links are not broken.
DW will not do this. Furthermore, if you rename or move a
linked file, you
will break that link, since DW cannot manage them either.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"KellyFaith" <[email protected]> wrote in
message
news:e3fpba$mh1$[email protected]..
> I'm relatively new to DW. I have a complex navigation
bar created using
> javascript. Is there a way I can check that there are no
broken links in
> the
> navigation bar? When I use the Link Checker, it does not
appear to check
> the
> links in the javascript. I need to make sure the links
are not broken.
> -
Insert pdf into a Portfolio via Javascript
Hi,
I'm hoping someone can help me, as I am struggling to find an answer for this. Admittedly, I am new to Acrobat JS. I've checked the Adobe Javascript API, and I can't seem to find out how to do it. The only collection methods all relate to fields, and the properties are fields, initialDoc and initialview. I can't seem to see how to add a doc at all.
In my searches, I did find this utility: New Feature added to Joel’s PDF Portfolio Utilities: Version 1.7 – The PDF Developer Junkie Blog
He does provide an interesting function in javascript: "Combine all open PDF portfolio's"
Checking the source code on that I see the following:
function ADBE_JFG_CombineCollections()
//get an array of all of the open documents
var docs = trustedActiveDocs();
if (docs.length > 0)
//Create a new empty portfolio
newPortfolio = trustedNewCollection();
//create a thermometer
t = app.thermometer;
t.duration = docs.length;
t.begin();
i=0
//loop through each open document
for each (doc in docs)
t.value = i
//if the document is a Portfolio... (we won't add single PDFs)
if (doc.collection)
//first add all the fields that we need
for each (f in doc.collection.fields)
try
newPortfolio.collection.addField({name:f.name, text:f.text, type:f.type});
console.println("Field named "+f.name+" added");
catch (err)
console.println("Field named "+f.name+" already present.");
for each (item in doc.dataObjects)
t.text = "Inserting file "+item.name;
newPortfolio.createDataObject(item.name, "");
newPortfolio.setDataObjectContents(item.name, doc.getDataObjectContents(item.name));
for each (f in doc.collection.fields)
newPortfolio.getDataObject(item.name).setFieldValue(f.name, item.getFieldValue(f.name));
t.end()
The problem is, his code will only work on portfolio's that exist already. I tried to modify it as a test to see if I could cobble something together to fit my needs and did the following:
function portTest()
var docs = trustedActiveDocs();
newPortfolio = trustedNewCollection();
//loop through all open docs
if (docs.length > 0 )
t = app.thermometer
t.duration = docs.length;
t.begin();
i=0
for each (doc in docs)
t.value = i
t.text = "Inserting file "+doc.documentFileName;
newPortfolio.createDataObject(doc.documentFileName, "");
newPortfolio.setDataObjectContents(doc.documentFileName, doc.getDataObjectContents(doc.documentFileName));
t.end();
This was unsuccessful, causing adobe to raise an internal error if attempted as a script, and the debugger gives me an error as well. If I comment out this line:
newPortfolio.setDataObjectContents(doc.documentFileName, doc.getDataObjectContents(doc.documentFileName));
The script runs, creating a new portfolio, and inserting an entry for a new doc, but that entry has no contents. As far as the API seems to document, getDataObjectContents() seems to be used to read external files (which I assume Acrobat treats docs in a portfolio/collection as an attachment and that's why Joel's code works? I am unclear on this though). At this point, I am lost... how can I get the doc(s) I want to be inserted into a portfolio? I thought it would be a lot easier than what this has turned out to be, and unfortunately there isn't a plethora of resources on the subject. Sorry, I've been working on this for four days, and keep spinning my wheels. Thank you in advance for any help or pointers you could offer.You probably are too new to ObjectOrientated languages and JavaScript.
The sample code you provided does not include the other functions that Joel is using to populate an an array variable whose elements or cells contain the object name for the opened PDF files.
The line of code:
var docs = trustedActiveDocs();
Calls the "trustedActiceDocs" function. This function uses Acrobat's app.activeDoc object array to populate the "docs" variable.
And there are even more supporting functions that Joel has declared as part of the entire script file. -
How to pass the javascript variable value to a jsp
Hi
I am trying to set a javascript variable with onClick event of a radio button in jsp
and I am assigning this variable to a hidden property in JSP whic has the corresponding getter an setter method in form.
But I am not able to retrtieve the value assigned in either form/action .can any body help me in this:
The code is
<script language="javascript">
var jais="";
function setValue(val)
jais=val;
document.o.value=jais;
</script>
<html:hidden property="o" value=""/>
<input type=radio name="1"
value="xyz"
onclick="setValue('XYZ')" >
ABC
and in the correspoding form bean I have
private String o_val =null;
public String geto()
return o_val;
public void seto(String strs)
o_val=strs;
In the action I am trying to access
by
1)String j=((form name)form.geto();
2)String j=request.getParameter("o")
but with both of them I am getting the value null
Thanks in AdvanceYou need to set the value of the hidden field in your function.
Setting an unrelated variable will not help.
function setValue(val)
document.forms[0].o.value = val;
also your get/set methods should be getO() and setO(). -
In a JSP Page, onclick of submit, it is submitting twice.
Hello! everybody...
Please help me.. its urgent!
I have a jsp page, after i enter values in textboxes and click on submit, i am calling a javascript function wherein i am submitting the form.
The problem is, it is submitting twice and inserting the record in the database twice.
here is my code.
anybody pls let me know where the problem is?
Thanks in advance.
/*Javascript Function for onsubmit*/
function addVersion()
alert('hi');
this.VersionDynaForm.action = "./Version.do?param=add";
this.VersionDynaForm.submit();
<html:form action="/Version.do" styleId="VersionDynaForm" onsubmit= "return addVersion()">
<input type="hidden" name="actionType" value="">
<table cellspacing=0 cellpadding=2 border=0 class="table_view" id="TABLE3" >
<tr class="table_data">
<td class="smalltext" width="200px" align="left"><b>Year<span style="color:Red;">*</span></b></td>
<td width="150px">
<select id="FLP_YEAR" name="FLP_YEAR" class="mediumtext" style="width:120px; height:30px" onchange="FLP_YEARChanged()">
<option value="">Select</option>
<%
ArrayList year = new ArrayList<Version>();
year = (ArrayList)session.getAttribute("years");
if(year!=null)
for(int i=0;i<year.size();i++){
Version temp1 = (Version)year.get(i);
if(temp1.getFLP_YEAR().equals(Element6)){
%>
<OPTION selected value='<%=temp1.getFLP_YEAR()%>'><%=temp1.getFLP_YEAR()%></OPTION>
<%}
else{%>
<OPTION value='<%=temp1.getFLP_YEAR()%>'><%=temp1.getFLP_YEAR()%></OPTION>
<%}
%>
</select>
</td>
<td width="150px"></td>
<td width="200px"></td>
<td width="200px"></td>
<td width="150px"></td>
<td width="150px"></td>
<td width="200px"></td>
</tr>
<tr class="table_data">
<td class="smalltext" width="200px" align="left"><b>Business Line<span style="color:Red;">*</span></b></td>
<td widht="150px">
<select id="LPA_BUSINESS_LINES" name="LPA_BUSINESS_LINES" class="mediumtext" style="width:120px; height:30px" onchange="alert('hi');testChanged()">
<option value="">Select</option>
<%
ArrayList lst1 = new ArrayList<Version>();
lst1 = (ArrayList)session.getAttribute("mnemonic1");
if(lst1!=null)
for(int i=0;i<lst1.size();i++){
Version temp1 = (Version)lst1.get(i);
if(temp1.getLPA_BUSINESS_LINES().equals(Element1)){
%>
<OPTION selected value='<%=temp1.getLPA_BUSINESS_LINES()%>'> <%=temp1.getLPA_BUSINESS_LINES()%></OPTION>
<%}
else{%>
<OPTION value='<%=temp1.getLPA_BUSINESS_LINES()%>'> <%=temp1.getLPA_BUSINESS_LINES()%></OPTION>
<%}
%>
</select>
</td>
<td width="150px"></td>
<td width="200px"></td>
<td width="200px"></td>
<td width="150px"></td>
<td width="150px"></td>
<td width="200px"></td>
</tr>
<tr class="table_data" align="left">
<td class="smalltext" width="200px" align="left"><b>RC Number<span style="color:Red;">*</span></b></td>
<td width="150px">
<select id="LPA_RC_NUMBER" name="LPA_RC_NUMBER" class="mediumtext" style="width:120px; height:30px" onchange="LPA_RC_NUMBERChanged()">
<option value="">Select</option>
<%
ArrayList lst2 = new ArrayList<Version>();
lst2 = (ArrayList)session.getAttribute("rcmnemonic");
if(lst2!=null && Element2!=null)
for(int i=0;i<lst2.size();i++){
Version temp2 = (Version)lst2.get(i);
if(temp2.getLPA_RC_NUMBER().equals(Element2)){
%>
<OPTION selected value='<%=temp2.getLPA_RC_NUMBER()%>'> <%=temp2.getLPA_RC_NUMBER()%></OPTION>
<%}
else{%>
<OPTION value='<%=temp2.getLPA_RC_NUMBER()%>'> <%=temp2.getLPA_RC_NUMBER()%></OPTION>
<%}
%>
</select>
</td>
<td class="smalltext" width="200px" align="left"><b>Version<span style="color:Red;">*</span></b></td>
<td width="150px">
<select id="LPA_VERSION_ID" name="LPA_VERSION_ID" class="mediumtext" style="width:120px; height:30px" onchange="LPA_VERSION_IDChanged()">
<option value="">Select</option>
<%
ArrayList ver = new ArrayList<Version>();
ver = (ArrayList)session.getAttribute("version");
if(ver!=null && Element5!=null)
for(int i=0;i<ver.size();i++){
Version temp3 = (Version)ver.get(i);
if(temp3.getLPA_VERSION_ID().equals(Element5)){
%>
<OPTION selected value='<%=temp3.getLPA_VERSION_ID()%>'> <%=temp3.getLPA_VERSION_NO()%></OPTION>
<%}
else{%>
<OPTION value='<%=temp3.getLPA_VERSION_ID()%>'> <%=temp3.getLPA_VERSION_NO()%></OPTION>
<%}
%>
</select>
</td>
<td width="150px"></td>
<td width="200px"></td>
<td width="200px"></td>
<td width="150px"></td>
</tr>
<tr class="table_data" >
<td class="smalltext" width="200px" align="left"><b>Project<span style="color:Red;">*</span></b></td>
<td width="150px">
<select id="LPA_PROJECT_NAME" name="LPA_PROJECT_NAME" class="mediumtext" style="width:120px; height:30px" onchange="LPA_PROJECT_NAMEChanged()">
<option value="">Select</option>
<%
ArrayList lst3 = new ArrayList<Version>();
lst3 = (ArrayList)session.getAttribute("project");
if(lst3!=null && Element3!=null)
for(int i=0;i<lst3.size();i++){
Version temp2 = (Version)lst3.get(i);
if(temp2.getLPA_PROJECT_NAME().equals(Element3)){
%>
<OPTION selected value='<%=temp2.getLPA_PROJECT_NAME()%>'> <%=temp2.getLPA_PROJECT_NAME()%></OPTION>
<%}
else{%>
<OPTION value='<%=temp2.getLPA_PROJECT_NAME()%>'> <%=temp2.getLPA_PROJECT_NAME()%></OPTION>
<%}
%>
</select>
</td>
<td align="left" class="smalltext" width="150px"><b>Version Name</b><span style="color:Red;">*</span></td>
<td><input type="text" class="smalltext" property="LPA_VERSION_NAME" name="LPA_VERSION_NAME" value="" maxlength="30"/></td>
<td width="150px"></td>
<td width="200px"></td>
<td width="200px"></td>
<td width="200px"></td>
</tr>
</table>
<table cellspacing=0 cellpadding=2 border=0 class="table_input" id="TABLE2" >
<tr class="table_input">
<td height="10px" colspan="5" class="table_top_td" align = "right" >
<INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="submit" value="NewVersion" class="btn" >
<INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="button" value="Update" class="btn" name="method" onclick="javascript:return updateFunction();">
<INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="button" value=Cancel class="btn" name="method" onclick="history.go(-1)" >
</td>
</tr>
</table>hi
change the type="button" in the following line
<INPUT id="button" class="mediumtext" style="width:80px; height:20px;" type="submit" value="NewVersion" class="btn" >
and call the javascript function on onClick in above line and dont call it from form(tat u hav done), remove it from form
then it wont submit twice
-venkat -
Radiogroup "onClick" function in ApEx?
Hello,
I have a radiogroup and a select list in a form. On click on the radiogroup the content of the select list should change.
How is it possible in Apex. Is it just possible to do it with javascript and an "onclick" function?
Thx in advance!
Greetings, HamburgerI have a same problem, but I think that I resolved it with tis way
1. Create a hidden static item (P?_CONT)
2. Create a radiogroup with submit (P?_CHECK) with values (0,1)
3. Create a selected list with redirect (P?_LIST:
SELECT ... WHERE :P?_CHECK=..
4. Create a report region : SELECT ... WHERE P?_LIST=...
5. Create a branch (After submit) with clear cache option at this page
and set items P?_CONT=&P?_CHECK., P?_CHECK=&P?CHECK.
which are worked at condition P?_CONT != P?_CHECK
It seems to me that it works well -
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). -
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;
} -
How to call jpf controller method from javascript
Can any one help me how to call pageflow controller method from JavaScript.\
Thanks.Accessing a particular pageflow method from Javascript is directly not possible unless we do some real funky coding in specifying document.myForm.action = xyz...Heres what I tried and it did not work as expected: I found another workaround that I will share with you.
1. In my jsp file when I click a button a call a JavaScript that calls the method that I want in pageflow like this: My method got invoked BUT when that method forwards the jsp, it lost the portal context. I saw my returned jsp only on the browser instead of seeing it inside the portlet on the page of a portal. I just see contents of jsp on full browser screen. I checked the url. This does make the sense. I do not see the url where I will have like test1.portal?_pageLabe=xxx&portlet details etc etc. So this bottom approach will notwork.
document.getElementById("batchForm").action = "/portlets/com/hid/iod/Batches/holdBatch"; // here if you give like test1.portal/pagelable value like complete url...it may work...but not suggested/recommended....
document.getElementById("batchForm").submit;
2. I achieved my requirement using a hidden variable inside my netui:form tag in the jsp. Say for example, I have 3 buttons and all of them should call their own action methods like create, update, delete on pageflow side. But I want these to be called through javascript say for example to do some validation. (I have diff usecase though). So I created a hidden field like ACTION_NAME. I have 3 javascript functions create(), update() etc. These javascripts are called onclick() for these buttons. In thse functions first I set unique value to this hiddent field appropriately. Then submit the form. Note that all 3 buttons now go to same common action in the JPF. The code is like this.
document.getElementById("ACTION_NAME").value = "UPDATE";
document.getElementById("batchForm").submit.
Inside the pageflow common method, I retriev this hidden field value and based on its value, I call one of the above 3 methods in pageflow. This works for me. There may be better solution.
3. Another usecase that I want to share and may be help others also. Most of the time very common usecase is, when we select a item in a drop bos or netui:select, we want to invoke the pageflow action. Say we have 2 dropdown boxes with States and Cities. Anytime States select box is changed, it should go back to server and get new list of Cities for that state. (We can get both states and cities and do all string tokenizer on jsp itself. But inreality as per business needs, we do have to go to server to get dynamic values. Here is the code snippet that I use and it works for all my select boxes onChange event.
This entire lines of code should do what we want.
<netui:anchor action="selectArticleChanged" formSubmit="true" tagId="selectPropertyAction"/>
<netui:select onChange="document.getElementById(lookupIdByTagId('selectPropertyAction',this )).onclick();" dataSource="pageFlow.selectedArticleId" >
<c:forEach items="${requestScope.ALL_ARTICLE}" var="eachArticle">
<%-- workshop:varType="com.hid.iod.forms.IoDProfileArticleRelForm" --%>
<netui:selectOption value="${eachArticle.articleIdAsString}">${eachArticle.articleItemName}</netui:selectOption>
</c:forEach>
</netui:select>
See if you can build along those above lines of code. Any other simpler approches are highly welcome.
Thanks
Ravi Jegga -
Problem in onClick attribute of the netui:anchor tag
Hi,
I have a String object to be passed to the javascript function with onClick attribute.
eg: <%String st = new String("helo");%>
<netui:anchor action="display" onClick="display()">
I want to pass the object st to the java script so that I can do some validations. how can I do that. If I say,
onClick="display('<%=st%>')" it is not working. can you please suggest me a solution.
Regards,
Satish.I haven't tried this with the netui:anchor tag, but it works with the netui:button tag.
<%
String onCl = "display('" + st + "')";
%>
<netui:anchor action="display" onClick="<%=onCl%>">
Apparently, you can place a scriptlet inside the onClick attribute, but you cannot intermingle the scriptlet with plain text.
Also, the onclick attribute appears not to support XScript ({request.whatever}). I find that weird.
Maybe you are looking for
-
How do I resolve a (-50) error message?
When I try to share a music video with iDVD, it returns the error message, "Unable to prepare project for publishing. The project could not be prepared for publishing because an error occurred. (-50)" I tried sharing with iTunes and Media Browser, bu
-
Even though I entered a credit card. Will it not charge anything if I only install the free apps? Is there like a monthly charge or just a charge when I want to buy apps that cost actual money?
-
Internet explorer 8 not displaying margin
I have a section on the left side of the website that has the main navigation menu (a spry vertical menubar). Beneath that I have a "What's New" div that is a small square that is the same width as the spry vertical menubar. This new items has a 20
-
How do i authorize a computer i have 2 id's
How do I authorize a computer?
-
Generate new user in Oracle BPEL Worklist
Hello, how can I put on in the Oracle BPEL Worklist a new user? I have already read the tutorials in addition. Or if one can work only with the preset users like jstein and jcooper. Thank Greeting Cathleen