Hello im new on af and I´m trying to redirect by clicking on any adf component to another page. But i dont want to use javascript only with adf and beans.
I have been looking for something similar to the onclick of javascript that you can use it on any html element and with a click you can invoke a function.
On my test i had tried to redirect to another page by clicking on a af:inputText like when i click on an af:link and execute the action with the name of the control flow case for navigate from one activity to another, looking on the documentation, the af:inputText doesn´t have any onclick/action event or something similar.
primera.jsff
<?xml version='1.0' encoding='UTF-8'?>
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<!--af:link When i click on it i get redirected to another jsff page on my project -->
<af:link text="link 1" id="link1" action="gonext"></af:link>
<!--I want a similar behavior here -->
<af:inputText label="Label 1" id="it1"/>
</ui:composition>
My task-flow has defined a control flow case from primera.jsff to a empty segunda.jsff named gonext
I just want the similar behavior on the af:inputText than on the af:link, but only using adf not javascript code. Thanks and sorry for the redaction.
I am using the below code to display a table in jsp with display-table and having a checkbox , but its not working in IE7 first time . can any one help.
<display:column title="Match
<acronym title='Select/Deselect All'>
<input type='checkbox' name='checkall' onclick='checkUncheckAll(this);' id='arResults'/>
</acronum>" class="center">
If you have js files in your site try change position like if you have ui.js move it or if you have javascript move it to the footer
I am trying to find Submit element. My HTML structure is as below.
<div>
<span class="combutton">Submit</span>
</div>
<div>
<span class="combutton">Cancel</span>
</div>
In browser using firebug I tried
$('div .combutton')[0].click()
which clicks on submit perfectly. But using selenium driver this element is not found. Please tell me how to do this using
driver.findElement(By.css("CSSSELECTORSTRING"))
What you did in Firebug shouldn't have any effect since it's clicking on a span and not the a inside it.
This should work, unless you omitted certain parts of your markup that would otherwise prevent it:
driver.findElement(By.cssSelector("div:first-child .combutton a")).click();
try that :
driver.findElement(By.xpath("//div span.combutton a[contains(.,'Submit')]")).click();
or
driver.findElement(By.xpath("//div span.combutton[0] a")).click();
I am trying to create a download link in a JSF page. The page has many richfaces fields that have validation enabled. Some have validator methods attached to them, some just have the required attribute set to true. The download link is an h:commandlink element. This link is supposed to download a file from the server. When I click on the link, validation on a few fields is triggered. How can I avoid this?
Thanks.
Either put it in a separate form,
<h:form>
... other input fields ...
</h:form>
<h:form>
<h:commandLink value="Download" action="#{bean.download}" />
</h:form>
or use immediate="true" so that all input fields which do not have this attribute set will be skipped in the process
<h:commandLink value="Download" action="#{bean.download}" immediate="true" />
The issue was with the file on the server side. Issue resolved.
We've used for some years a home-grown file uploader for our classic ASP website. It works like this:
ASP page sets some specific constants and #includes an ASP library called Browse-Files.asp.
Browse-Files.asp displays, inside the #including page, a file explorer-like view of the directories and files in a directory. It also shows various HTML links to allow file modification functions - create a directory, upload a file, move, rename and delete existing files.
Each of these links calls a Javascript function that generates a simple HTML page in a popup window. These popups contain the required HTML form for the requested file modification activity. The HTML source for the popup pages is generated on the fly by Javascipt, rather than loading a static .htm or .asp file (this is purely so that all of the functionality of Browse-Files.asp is located in 1 file).
The user fills in the popup form and submits. The form submits back to the parent page (form target attribute) and closes itself (Javascript timer, window.close).
The parent page refreshes due to the form submit, showing the change the user requested.
Issue is: this has worked fine for some years on various browsers, IE 6 to 8, Firefox and Opera. However, in IE9, the file upload does not work. The other popup-based tasks such as file renaming and directory creation continue to work.
Code - the file rename popup (works in IE9 and all before):
<html>
<head>
<title>Rename</title>
<link rel="stylesheet" href="/Common/CSS/screen.css" type="text/css" media="screen" />
</head>
<body>
<h1>Rename</h1>
<p>Enter the new name for "Config Mgmt Text.txt" in the folder "General/Share-Files/":</p>
<form name="form" method="post" action="/General/Share-Files.asp" encType="multipart/form-data" target="Browse-Files" onSubmit="self.setTimeout('window.close()', 500)">
<input name="task" type="hidden" value="T03" />
<input name="path" type="hidden" value="General/Share-Files/" />
<input name="target" type="hidden" value="Config Mgmt Text.txt" />
<input name="name" type="text" tabindex="1" size="40" value="Config Mgmt Text.txt"></input>
<input name="submit" type="submit" value="Rename" tabindex="2" />
</form>
</body>
</html>
Code - the file upload popup (broken in IE9, works in all before):
<html>
<head>
<title>Add Files</title>
<link rel="stylesheet" href="/Common/CSS/screen.css" type="text/css" media="screen" />
</head>
<body>
<h1>Add Files</h1>
<p>Browse for files to add to the folder "General/Share-Files/":</p>
<form name="form" method="post" action="/General/Share-Files.asp" encType="multipart/form-data" target="Browse-Files" onSubmit="self.setTimeout('window.close()', 500)">
<input name="task" type="hidden" value="T01" />
<input name="path" type="hidden" value="General/Share-Files/" />
<input name="file1" type="file" tabindex="1" size="40"></input><br />
<input name="file2" type="file" tabindex="2" size="40"></input><br />
<input name="file3" type="file" tabindex="3" size="40"></input><br />
<input name="file4" type="file" tabindex="4" size="40"></input><br />
<input name="file5" type="file" tabindex="5" size="40"></input><br />
<input name="submit" type="submit" value="Upload Files" tabindex="6" />
</form>
<p>Note that upload speed depends on your internet connection speed.</p>
</body>
</html>
All the forms are encType="multipart/form-data" to accomodate the file upload, and the ASP on the main page does a Request.BinaryRead(Request.TotalBytes) first thing with the form data. It then parses the data by delimiter, splitting it out into binary data (uploaded files) and text data (regular form fields). One of these regular form fields, <input name="task" type="hidden" value="T01" />, is how it knows what to do with the submitted data (rename a file, upload a file, etc).
So, why does uploading, and only uploading, not work in IE9?
As above, the form submit method is the same for uploading and other (working) form actions, as is the server-side parsing of HTTP POST.
Debugging has shown that the file upload popup never even submits data back to the parent page (or to itself), i.e.the form data is never submitted to the server in the first place. But, all the other forms work the same way and do submit.....
Could this be something completely unrelated to code, like an IE9 security setting?
Have even tried forcing IE8 compatability mode on IE9 (<meta http-equiv="X-UA-Compatible" content="IE=8" >), no change.
Any assistance greatly appreciated.
Thanks
Lukas
Update:
1) "Doesn't work" means that the upload popup dissapears on submit (as it should), but nothing is ever submitted to the parent page. If I disable the auto-close on the popup: after clicking submit the text fields containing the path(s) to the file(s) to be uploaded are cleared, but nothing else happens. This suggests that it is submitting to the popup page rather than the parent page, but that doesn't really make sense, as the other (working under IE9) popup pages still correctly submit to the parent page. I'll try replacing the JS-generated popup page with a conventional ASP page that can show any HTTP POST data, and go from there.
2) If I force compatability mode on the client side (IE9 compatability view button), it does work exactly as it should. This is more workaround than fix though. I suppose it does rule out browser settings though, as compatability mode would only affect page rendering?
I was able to solve this issue in Windows7 & IE9 (worked in all other browsers and versions I could test) by making sure the first attribute of the initiating window.open() call had a viable url in it.
I was actually write()'ing to the opened window to stick the code in it that I wanted, which included the file upload form. So I didn't have a url I needed to declare on the opened window. It said "about:blank" in the address bar. Further, by hitting F12 in the window, I could see I was getting a "SCRIPT5: Access is denied" error when I tried to submit the form.
I was calling the popup window like this:
var popup_window = window.open("","upload_popup_window_name","menubar=1,resizable=1,scrollbars=1,width=630,height=400");
By changing the above to:
var popup_window = window.open("/blank.html","upload_popup_window_name","menubar=1,resizable=1,scrollbars=1,width=630,height=400");
Where /blank.html was an actual file that the web server returned a 200 code upon the request(although it could actually be the source of the url you wanted to call, I'm assuming if you had already done it this way, it would work).
I still overwrote the contents of the window by by document.write()'ing all my own code into the window they way I was previously doing anyways.
By making this small modification, IE9 then allowed file uploads to be INITIATED by the popup window and I no longer received the "SCRIPT5: Access is denied" error. And files began to be successfully uploaded again.
Hope that helps
Is ie 9 case sensitive to your form attributes?
try changing:
encType="multipart/form-data"
to:
enctype="multipart/form-data"
and clear your cache.