Assigning the file path to a text field
I assume this is simple, but I can't figure it out...
I want to be able to print out the the file name on my form -- preferably the full path to the PDF file, e.g. N:\MyFolder\MySubfolder\MyFormName.PDF
I have been looking at the GetAttribute command but I can't seem to find the file name and path in the XML object model.
The filename and path are not stored in the XML.
The command event.target.path will return the full path and file name to you. The command event.target.documentFilename will return just the filename - no Path.
Similar Messages
-
File browse : How to keep the file path in the file browse field?
Hello,
I have
1) file browse field called P2_FILE_PATH.
2) a select list with submit : P2_REGION
If i upload some file d:\abc.gif , then select some region in the P2_REGION,
P2_FILE_PATH will become empty. But in the session, i can find the blob value. but not the "d:\abc.gif "
Using the following script I could capture the value of P2_FILE_PATH in a field
P2_TEST.
onload="javascript:document.getElementById(P2_FILE_PATH').value = document.getElementById('P2_TEST').value;"
P2_TEST contains d:\abc.gif .
How to retain the file path, though some other field is selected and submitted?
Thanks in advance.
Regards,
ArchanaHello Archana,
You can't do what you want because of some HTML security restrictions – nothing to do with APEX. As you found out, You can capture the value of this item. You can't set it. After submitting the page, the browser is the one to clear the item.
The only workaround is to work with AJAX and not submit the page until the end of the user input phase.
Regards,
Arie. -
Getting the file path from a File browse button
Hi,
I was wondering if there is a way to extract the whole file path (not just the file name) from a file which is selected using a file browse button?
I am trying to save the file path as text in my database (I don't want to upload the file). I have linked the file browse object to a table field in the database. But when entered in the database, all I get is a series of random characters, followed by the file name. I would like to have the complete file path instead.
TomHi thanks
I've placed the java script into the head of the page, but unsure as to how to change the taget url for my submit button from doSubmit('SUBMIT') to doPrepareAndSubmit('SUBMIT'). In fact I don't actually have a submit button, but a save new record (which performs an SQL INSERT into the database using the values contained in the fields on the page) or a update record buttons instead.
I'm sorry but my knowledge of java scripts is not very good either.
How do I do the follwoing?: if your submit button has not any target set its target to url:
javascript: doPrepareAndSubmit('SUBMIT')
Cheers, Tom -
Issue with Getting the file path from InputFile component
Hi,
One of our requirement is like below:
I am working on ADF 11g (latest release R1) page. User will select the file and when he/she clicks on the Save button we need to store the file path in the database.
In the database file_path is varchar2(300). We need to store just the file path. I am using InputFile component but filepath is not getting inserted.
This is really urgent. It would be really appreciate if anyone can guide me on this.
Thanks
MCHi Mahesh,
I have manage to store the file path from the InputFile component in Jdev 11g. I found the file upload script from this forum and manage to alter it so that i could save the file path to the database. But my problem is to retrieve it back to view as a document. Hope this will help you :)
This is an example of what I have manage to save to my DB :
(CLOB) //192.168.238.53/c$/Research/Docs/0906160744/EyeCandyLog.txt
In my form, I save the file path first before I update the other fields. My code is something like this :
public void uploadFile(ValueChangeEvent valueChangeEvent) {
// Add event code here...
InputStream in;
FileOutputStream out;
if(tanda == 0){
try {
// final Context context = getInitialContext();
RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
id = rS01Proposal.dptProposalid();
tanda = tanda + 1;
System.out.println("tanda"+ tanda);
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("id"+id);
proposal = id.substring(6);
System.out.println("proposal"+proposal);
UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue();
String fileUploadLoc = "//192.168.238.53/c$/Research/Docs/"+id+"/";//The place where file will saved
//create upload directory
boolean exists = (new File(fileUploadLoc)).exists();
if (!exists) {
(new File(fileUploadLoc)).mkdirs();
if (file != null && file.getLength() > 0) {
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage("File Uploaded " + file.getFilename() +
" (" + file.getLength() + " bytes)");
*// extracting the file message to get the path*
context.addMessage(valueChangeEvent.getComponent().getClientId(context), message);
columnL = valueChangeEvent.getComponent().getClientId(context);
column = columnL.substring(9);
System.out.println(column);
columnLengkap = "RS01"+column.toUpperCase();
System.out.println("columnLengkap"+columnLengkap);
*try {*
out = new FileOutputStream(fileUploadLoc + "" + file.getFilename());
in = file.getInputStream();
*for (int bytes = 0; bytes < file.getLength(); bytes++) {*
out.write(in.read());
in.close();
out.close();
} catch (IOException e) {
e.printStackTrace();
} else {
String filename = file != null ? file.getFilename() : null;
String byteLength = file != null ? "" + file.getLength() : "0";
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage(FacesMessage.SEVERITY_WARN, " " + " " +
filename + " (" + byteLength + " bytes)",
null);
context.addMessage(valueChangeEvent.getComponent().getClientId(context),
message);
System.out.println(fileUploadLoc+file.getFilename());
a = fileUploadLoc+file.getFilename();
b = b + 1;
if (flagInsert == 0){
try {
// final Context context = getInitialContext();
RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
rS01Proposal.insertDoc(id,proposal,columnLengkap,a);
flagInsert = flagInsert + 1;
System.out.println("tanda"+ tanda);
//session
ProposalSession.storeCurrentProposalId(id);
} catch (Exception ex) {
ex.printStackTrace();
}else{
// update proses
try {
// final Context context = getInitialContext();
RS01Proposal rS01Proposal = (RS01Proposal)new InitialContext().lookup("Phase2-RS01Proposal#sr.model.RS01Proposal");
rS01Proposal.updateDoc(id,proposal,columnLengkap,a);
flagInsert = flagInsert + 1;
//session
ProposalSession.storeCurrentProposalId(id);
System.out.println("tanda"+ tanda);
} catch (Exception ex) {
ex.printStackTrace();
} -
How to set the file path dynamically based on sytem, username, and date
Hi All,
My requirement is upload the data into one structure like xyz that is related to t.code MCSZ.
file will be in UNIx SERVER .
PATH IS: /sapif
file name is xy789 load .txt
I have to write code in one user-exit
how can i set the file path for this.
shall i put hard code file path?
because i have to writecode in user-exit.
plz tell me how to set the file path based ons syetem, username, date
Thanks in advance
Ram.AConcatenate the field SY-SYSID, SY-UNAME and SY-DATUM for the file path
-
Enable and Disable the file paths
Hai i have two file paths one logical file path and other is physical file path.
I took two radio buttons.
How can i enable and disable the file paths by using these radio buttons.
When i select the 1st radio button then 1st file path is in enable and second file path in disable mode similarly for the second radio button also.
It is very urgent .
With Regards,
Prasad.Tallapudi.i answered in your other post....here is the code again....
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: logfile type string default 'Z_DATALOAD',
FILE(128) TYPE C DEFAULT 'nittest.txt' LOWER CASE.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
PARAMETERS: P_LFILE RADIOBUTTON GROUP G1 USER-COMMAND C1 DEFAULT 'X',
P_PFILE RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
at selection-screen output.
if p_lfile eq 'X'.
loop at screen.
if screen-name = 'LOGFILE'.
screen-input = '1'.
endif.
if screen-name = 'FILE'.
screen-input = '0'.
endif.
modify screen.
endloop.
endif.
if p_pfile eq 'X'.
loop at screen.
if screen-name = 'LOGFILE'.
screen-input = '0'.
endif.
if screen-name = 'FILE'.
screen-input = '1'.
endif.
modify screen.
endloop.
endif.
if the problem gets solved...please close both the posts -
Hello Everybody,
Can someone tell me how to do the F4 for the file which is to be loaded from the presentation server,like v have for UPLOAD Function Module.
I have a Parameter for the file path in the selection,I want to know how do v take the file path by searching thru F4??
Thanks,
Anushka.Hi Anushka,
refer sample code:
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : rb_pc RADIOBUTTON GROUP r1 DEFAULT 'X'
USER-COMMAND ucomm, "For Presen
p_f1 LIKE rlgrap-filename
MODIF ID rb1, "Input File
rb_srv RADIOBUTTON GROUP r1,
"For Application
p_f2 LIKE rlgrap-filename
MODIF ID rb2,
"Input File
p_direct TYPE char128 MODIF ID abc DEFAULT c_path
"File Directory
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-020.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f1.
*-- Browse Presentation Server
PERFORM f1000_browse_presentation_file.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f2.
*-- Browse Application Server
PERFORM f1001_browse_appl_file.
*& Form f1000_browse_presentation_file
Pick up the file path in the presentation server
FORM f1000_browse_presentation_file .
CONSTANTS: lcl_path TYPE char20 VALUE 'C:\'.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_path = lcl_path
mask = c_mask "',.,..'
mode = c_mode
title = text-006
IMPORTING
filename = p_f1
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
flg_pre = c_x.
ENDIF.
ENDFORM. " f1000_browse_presentation_file
*& Form f1001_browse_appl_file
Pick up the file path in the application server
FORM f1001_browse_appl_file .
DATA: lcl_directory TYPE char128.
lcl_directory = p_direct.
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = lcl_directory
filemask = c_mask
IMPORTING
serverfile = p_f2
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000(zmm) WITH text-039.
flg_app = 'X'.
ENDIF.
ENDFORM. " f1001_browse_appl_file
Reward points if this Helps.
Manish -
Cmd+v doesn't paste in the file upload dialogue's search field in Safari
In Safari 4.0.4 on OS X 10.6.2, cmd+v doesn't paste in the file upload dialogue's search field in Safari. It just makes an audio beep to indicate an error.
Using a sample file uploader:
1.) Visit http://upload.youtube.com/myvideosupload
2.) Click the "Upload Video" button.
3.) Select file(s) to upload to s.ytimg.com
4.) Click on the search text field
*5.) Cmd+V to paste text. Nothing happens.*
However, if you right-click, "Paste" is not grayed out, and you can paste normally.
This is for version 4.0.4, but this behavior has been present for as long as I can remember using Safari.
Can anyone confirm this bug?HI,
I can't confirm a bug but you can report it.
From the Safari Menu Bar click Safari/Report Bugs to Apple.
Carolyn -
It possible using javascript to change the value of another jsf text field?
In my case, I have an input text field and would like to copy it's value on the onchange() event into another text field. Using the destination text field's Id and assigning some content with it's .value property
Woodstock apparently renders some Javascript/DOM with some homegrown widget framework which on its turn renders the HTML DOM tree instead of plain vanilla HTML. Correct me if I'm wrong, to confirm this, just view the generated HTML source of the page.
After some Googling I found out that you need getProps() and setProps() to get and set element attributes respectively.
[http://google.com/search?q=webuijsf+domnode+site:sun.com].
If you stucks with this, I recommend you to post this question at a forum or mailinglist devoted to Woodstock, e.g at their own homepage at dev.java.net or the Netbeans forum at nabble.com. You're here at a Sun JSF forum, not at a Woodstock forum. -
Load multiple parts of an XML file into one dynamic Text Field
Hi I am trying to load text from an external XML file into a dynamic text box. I have so far managed to load single parts of the XML file into a dynamic text field. I now want to be able to load different parts of the XML file (something similar to a string with appendText) into the same text Field.
I have so far managed to achive this using the String and append text properties, but would like to use XML file to do it instead.
Any tips please?
ThanksIn essence you can just do:
TextField.text = XML.node1 + XML.node2; -
Change the font color of a text field in a table by key-combination
I want to change the font color of a text field in a table (single cell only) on pressing a key combination. Does anybody know how to do this.
I have a lot of data in a table. During an evaluation of the data in a meeting I want to change the color of the text depending on the result of the meeting. (for example: High risk = CTRL+R makes the text red).
I know how to change the color using a button, but I do not want to add a button after each cell. For this reason I would like to do it on a key combination that alway refers to the active cell.
Many thanks for your help in advance.
MarcelHi,
I don't think you can use the ctrl key like that as those shortcuts will be intercepted by Reader (ctrl-R toggles the ruler display on / off). You also might have trouble updating the color while you still have focus on it. You can use the shift key in a similar way, so if you only have lower case characters in the text fields then you can do something like;
if (xfa.event.shift)
switch (xfa.event.change)
case "R":
this.fontColor = "255,0,0";
break;
case "O":
this.fontColor = "255,102,0";
break;
case "G":
this.fontColor = "0,255,0";
break;
xfa.event.change = ""; // ignore character
If you need uppercase characters maybe you can have one button to set "review mode" and test that on the if (xfa.event.shift) line. But again it wont take effect until you have tabbed out of the field.
Regards
Bruce -
How to get the file path in adf application
hii all,
i have a txt file that i am using in my adf application,
i am passing this txt file through a File Reader, for which i have to mention the file path.
The file is in web-content and when i am hard coding the complete file path i.e C:/JDeveloper/myApp/ViewController/public_html/log.txt
the application is working fine when run on integrated weblogic server.
My requirement is to access this file without giving the static file path, as in case i have to use this application on any other machine..
for that how to mention the file path-
i tried using FacesContext to get the context path :-
FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
which gives me
\myApp-ViewController-context-root
after appending public_html\log.txt
I am using the following path to access the file :-
\myApp-ViewController-context-root\public_html\log.txt
again i am getting the java.io.FileNotFoundException
Does anyone know how to use file from inside the web-content without giving the complete path..???
ThanksHi,
If you put your file under public_html folder, you can use this code to access the file:
For example file is : log.txt
FacesContext.getCurrentInstance().getExternalContext().getRealPath('/log.txt').toString().trim();
Thanks.
- LSR -
I am experiencing this error with one of our cluster environment. Can anyone help me in this issue.
The Cluster Service function call 'ClusterResourceControl' failed with error code '1008(An attempt was made to reference a token that does not exist.)' while verifying the file path. Verify that your failover cluster is configured properly.
Thanks,
Venu S.
Venugopal S ----------------------------------------------------------- Please click the Mark as Answer button if a post solves your problem!Hi Venu S,
Based on my research, you might encounter a known issue, please try the hotfix in this KB:
http://support.microsoft.com/kb/928385
Meanwhile since there is less information about this issue, before further investigation, please provide us the following information:
The version of Windows Server you are using
The result of SELECT @@VERSION
The scenario when you get this error
If anything is unclear, please let me know.
Regards,
Tom Li -
I am building an application on a RT PXI system, and for one of the functions I would like the user to be able to use the browser button of the File Path Control to choose a directory on the PXI. However the browser button seems to only want open a file on the host PC, even though the application is fully deployed on the target. Note that I am controlling the PXI from a host PC.
If anyone has any suggestions that would be great. Thanks.Hi,
Unfortunately, there is not a VI to do this. Are you browsing to these files from your host VI? In order to access the files on your PXI RT target, you'll need to FTP in and browse to them that way. You could programmatically do this, but there is not a simple VI to do so.
Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments -
How to set the Background Color of a Text Field in a Tabular Report.
Hello,
I tried to set the Background Color of a Text Field in a Tabular Report.
But I was not able to change this colur.
In the report attributes --> column attributes
I tried already:
1. Column Formating -- >CSS Style (bgcolor: red)
2. Tabular Form Element --> Element Attributes (bgcolor: red)
but nothing worked.
Can anybody help me?
I Use Oracle Apex 2.2.1 on 10gR2
thank you in advance.
Oliverin "Report Attributes" select the column to move to the "Column Attributes" page. In the "Element Attributes" field under the "Tabular Form Element" region enter
style="background-color:red;"
I will also check if there is a way to do this via the template and post here again
edit:
in your template definition, above the template, enter the following:
< STYLE TYPE="text/css" >
.class INPUT {background-color:red;}
< /STYLE >
(remove the spaces after the < and before the >)
change "class" to the class that the template is calling
(I'm using theme 9, the table has: class="t9GCCReportsStyle1" so I would enter t9GCCReportsStyle1)
A side-effect of using this second version is that ALL input types will have a red background color--checkboxes, input boxes, etc.
Message was edited by:
TheJosh
Maybe you are looking for
-
Flex Guru's - Answer this if you can
I am having a strange problem. We have a Struts based application. All our JSP pages are within the WEB-INF folder. When I use Flex tags to even print a label, the compilation takes place, but then during execution page comes up blank with a backgrou
-
In our lab environment we have local home folders for all users, but the home folder name does NOT equal the short name of the user who logins. For example, the home folder in Users is called Local HomeDir. The user who authenticated ldap and logs in
-
Kv vs creative question,help PLZ
i have a 5. li've sound card series without li've dri've!now...in kx driver is a very usefull option( 4 me) :i can set the sub way jack 2 function as a headphone way!i would like 2 have this option available on creative driver's cuz' (i repeat) is ve
-
In sales order, what is schedule line
hi i m new to SD, pls tell me in a sales order created, i can see multiple line items, what is the meaning of having multiple "schedule lines"
-
Hi, I am having some problems using formulas. My report uses a structure (A = BCD+E). For example, the result of the report is: Var % = ((Value 2 / Value 1) - 1) * 100 Struct Value 1 Value 2 Var % A 155.377,32 18.3