How to know if a file browser item is not null using javascript fucntion

Hi
<br><br>
I tried to use javascript for validation. I have a file browser item named P55_FILE_NAME and I would like to know if this item is null or not before submit.
<br>
I wrote this function :<br><br>
function validate_import(f_n){<br>
     if (trim(document.getElementByName(f_n).src) == "")<br>
     {<br>
     alert ("File name is empty.");<br>
     document.getElementByName(f_n).focus();<br>
     }<br>
     else{<br>
     doSubmit('SUBMIT');<br>
     }<br>
} <br><br>
When I press submit button I got an error, sounds like the src method does not exist in my input item. <br>
Then, I looked my source page an I found this :<br><br>
input type="file" name="p_t01" size="30"
<br><br>
there is know src method and the name is not P55_FILE_NAME and I don't want to use <b>p_t01</b> that will change.<br>
<br>
I need your help.<br>
Benn

Hello,
The p_txx notation is the internal name the ApEx engine attaches to each page item. It starts with p_t01 (for the first item on page) and can end with p_t99 (hence, the max 99 items per page limit). You can see these names in your HTML source code.
The bug in the File Browse item (fixed in version 2.2) is that the ID of the item is the internal name instead of the item name. Hence, in order to use DOM, you need to use this internal notation.
If the File Browse item id is p_t01, you can null its content by using something like that (V2.0 notation) :
html_GetElement('p_t01').value = '';I'm using the same, and similar code, for manipulating this type of item with no problems.
Please document the use of this workaround, as when you'll upgrade your ApEx system, you will have to change this code back to the standard – item id equal item name.
(Please follow Scott's advise, and keep your logic connected issues on the same thread. It will get you more quick and accurate help).
Regards,
Arie.

Similar Messages

  • How to know whether a file is opened  or not ?

    Hi all,
    How to know whether a file is opened by its editor or not ? File may be any of the type.

    There are platform-dependent commands that tell whether a file (or directory, port etc.) is used by which processes.
    [oracle@izsak ~]$ fuser .
    .:                    9299c
    [oracle@izsak ~]$ ps -p  9299 -f
    UID        PID  PPID  C STIME TTY          TIME CMD
    oracle    9299  9298  0 Apr25 pts/0    00:00:00 -bash
    [oracle@izsak ~]$ ls -l $fn
    -rw-r-----  1 oracle oinstall 111215876 Apr 25 19:05 /opt/oracle/product/AS/10g/R2/opmn/logs/OC4J~ebank~default_island~1
    [oracle@izsak ~]$ fuser $fn
    /opt/oracle/product/AS/10g/R2/opmn/logs/OC4J~ebank~default_island~1:  3746  3747  3748  3749  3750  3751  3752  3753  3754  3755  3756  3758  3761  3762  3765  3767  3769  3770  3771 18638 21605 21743 21744 21745 22140 22143
    [oracle@izsak ~]$ ps -p 3746 -f
    UID        PID  PPID  C STIME TTY          TIME CMD
    oracle    3746 26427  0 Apr23 ?        00:00:01 /opt/oracle/product/AS/10g/R2/jdk/bin/java -server -Djava.security.policy=/opt...

  • How to know whether the file is opened or not

    Hi All,
    In the file handling,
    Before writing OPEN DATA SET, I want to know the file is already opened or not.
    Please help me out in this regard.
    Thanks and regards,
    Mallareddy

    Hi,
    Please try GET DATASET statement.
    Syntax:
    GET DATASET dsn.
    Extras:
    1. ... POSITION pos
    2. ... ATTRIBUTES attr
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. For details, see File Interface.
    Effect
    Used to get the properties of a file already open.
    You can use this statement without additions to determine whether the file is open.
    If the file is not open, an exception of the type CX_SY_FILE_OPEN_MODE is triggered.
    Regards,
    Ferry Lianto

  • How to get full path in file browse item

    Hi
    I have a file item. When I submit the form and store and value in db, then the file path is stored as numbers and appended to the file name. I undestand that this is because of some wwv flow files index or something . How to get the file path? Anybody...

    For security/privacy reasons recent versions of browsers by default do not send local file path information from File Browse items to the server, nor expose the file path in the control's JavaScript methods. Firefox, Safari and Chrome only provide the filename. IE6 & IE7 still yield the path in Windows format. IE8 and Opera have adopted an irritating approach of replacing the path with a wholly imaginary "C:\fakepath\".
    Changes to IE's security config can enable the path to be exposed in IE8, but I don't think it will be available via <tt>apex_application_files</tt>.
    For more information see:
    http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-March/018980.html
    http://blogs.msdn.com/ie/archive/2009/03/20/rtm-platform-changes.aspx

  • How to set "Files of type" when using a "File Browse" item.

    Apex 4.0.2
    Internet Explorer 7 +
    I have a "File Browse" item on a page and need to limit the types of files display to just "text (.txt)" files. How can this be done? Currently, the "Files of type" list shows "All File (*.*)", "Pictures (*.gif,*.png)", and HTML (*.htm,*.html)". In the best case, I would like to not have the "Files of type" list and have the user just limited to text files. However, adding Text files (*.txt)" to the "Files of type" list is ok.
    thanks,
    William

    Thought i'd do a bit of research after seeing Scotts wonderful ideas.
    So it turns out, IE made the file item read only from version 8, for security reasons. Read more: http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
    File Upload Control
    Historically, the HTML File Upload Control (<input type=file>) has been the source of a significant number of information disclosure vulnerabilities. To resolve these issues, two changes were made to the behavior of the control.
    To block attacks that rely on “stealing” keystrokes to surreptitiously trick the user into typing a local file path into the control, the File Path edit box is now read-only. The user must explicitly select a file for upload using the File Browse dialog.
    Additionally, the “Include local directory path when uploading files” URLAction has been set to "Disable" for the Internet Zone. This change prevents leakage of potentially sensitive local file-system information to the Internet. For instance, rather than submitting the full path C:\users\ericlaw\documents\secret\image.png, Internet Explorer 8 will now submit only the filename image.png.To resetting the actual items, suggestions I found were to replace the actual item. So instead of using $s, I just replace the element, with the existing element, causing it to re-initialise.
    var htmldb_delete_message='"DELETE_CONFIRM_MSG"';
    function fileCheck(el){
        if(el.value){
            var validFile = false;
            var validExtensions = ["csv"];
            var filename = el.value;
            var fileExtIndex = filename.lastIndexOf(".");
            var fileExt = filename.substring(fileExtIndex+1, filename.length);
            for(i = 0; i < validExtensions.length; i++){
                if(validExtensions[i] == fileExt){
                    validFile = true;
                    break;
            if ( !validFile || fileExtIndex == -1) {
                alert("Invalid Extension. Permitted files must end with: " + validExtensions.toString());
                var htmlContents = el.outerHTML || new XMLSerializer().serializeToString(el);
                $('#P16_BINARY').replaceWith(htmlContents);
    }(obviously, replacing what you need to, to suit your page - i prefer scotts idea of passing in supported file types in the function, so would just pass in an array instead; but this is just for demonstration)
    with an onchange="checkFile(this)" on the element attributes.
    On a slightly un-related note, I found out IE doesn't support the wonderful indexOf function on arrays, that checks for the existence of the value in an array. Sucks.
    Edited by: trent
    Ah well, jQuery is there, maybe i should use that for searching arrays in the future.
    http://api.jquery.com/jQuery.inArray/
    Edited by: trent
    Forgot a demo link, for csv files: http://apex.oracle.com/pls/apex/f?p=45448:16
    Edited by: trent
    Modify function. Didn't work in Firefox

  • How to populate DB column with filename from file browse item?

    Hi,
    Using APEX 3.1.2, I'm trying to easily allow maintenance of a filename stored in a DB column (VARCHAR2(1000)). Using the column as a file browse item seemed to be the way to go, but of course I don't want the resulting file to be uploaded and it appears as though an existing filename is not shown in a form when the row is retrieved.
    After much searching, I found Checking filename length in File Browse item before uploading , but I'm not able to connect the dots. I was thinking that I could create a hidden file browse item and use a button to call Javascript function to activate it, then save the resulting filename to my DB column item and wipe out the hidden item before it was uploaded. But the hidden item doesn't appear, so I'm not able to reference it's form input name.
    Hopefully this mess makes sense. Anyone?
    Thanks!
    Rich
    Edited by: socpres on Sep 5, 2008 2:02 PM because message was truncated after attempting to preview it first.

    Hi John,
    From what I can tell, the path of a local file browsed from a file browse item cannot be retrieved because of security concerns. Although, it seems that while Firefox 3 only returns the filename sans directory, IE6 returns the full path:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head><title>Form Test</title>
    </head><body>
    <script type="text/javascript" language="JavaScript">
    function GetDirectory()
    strFile = document.FileForm.filename.value;
    intPos = strFile.lastIndexOf("\\");
    strDirectory = strFile.substring(0, intPos);
    alert(strDirectory);
    document.FileForm.Directory.value = strDirectory;
    </script>
    <form id="FileForm" name="FileForm">
    <input type="file" id="filename" name="filename" value="" onChange="GetDirectory(this.value)">
    <input type="hidden" id="Directory" name="Directory" value="">
    </form>
    </body>
    </html>
    This Win-specific code displays the path via IE6, but not in Firefox 3. Then again, I can't seem to preview posts here using FF3, either...
    Rich

  • How stop File Browse item losing value when a validation occurs

    G'Day Apex gurus,
    I am using Apex 3.1.0 and Firefox in an XP PC and have a file browse page item on my page but whenever i experience a validation error on the page, the value entered into this box is lost.
    Every other field on the page retains its entered value, but the file browser item loses its value.
    This is frustrating because the user will have to reselect the file.
    Is there a way to retain the value upon a validation error?
    I appreciate any assistance with this
    Carlos

    Hey creyes,
    I don't think this is possible.
    Because of security implications (scripts setting the value, and then attempting to retrieve files of your computer) the value of the fileupload form field is read only. Therefore you cannot set, or reset the value.
    A solution could be that you make validations with javascript if possible (but keep validations on the database side also!).
    Kind regards,
    Oli

  • How to change the "Download" word indicated for a File browse item ?

    Hi,
    I have a File Browse item. It displays "Download". And works fine too ! i want to change the Message "Download" by "Télécharger". Where can I find this ?
    Thank you for your kind help !
    Christian

    Hello Christian,
    If you are referring to the DOWNLOAD on an interactive report that is set to download a blob (for example), you can change the word Download to be anything you wish in the Download Format Mask. The very last entry is the Download Message.
    DOWNLOAD:TABLE_NAME:BLOB_CONTENTS_COLUMN:PRIMARY_KEY_1:PRIMARY__KEY_2:MIME_Type_COlumn:FILENAME_COLUMN:LAST_UPDATE_DATE:CHARACTER_SET:CONTENT_DISPOISITION:DOWNLOAD_LINK_TEXT
    For example:
    DOWNLOAD:TABLE_Of_CONTENTS:TOC_PAGES:BOOK_ID:::PDF_FILENAME:MOD_DATE::ATTACHMENT:Click Here To Download This Book
    The message "Click Here To Download This Book" will appear for each link.
    Good luck,
    Don.
    You can reward this reply by marking it as either Helpful or Correct :)

  • File Browse Item questions..

    Hi all..
    Please help me with these questions on ""file_browse"" item.
    I have a file browse item on a page, like in the following app.
    http://apex.oracle.com/pls/apex/f?p=62812:1
    1) when the user select a file with the browse button,we will get the
    """file path""" in the text field.
    Is it possible to validate (via javascript or any other way), whether that particular
    ""file path"" is correct and a valid file exist as per the ""file path""??The reason for this validation is, sometime our users will copy the ""file path"" instead of using the
    file browse button.
    2) http://apex.oracle.com/pls/apex/f?p=62812:1
    If users enter a valid path, but on that particular page if i have any validations,
    If any of the validations fails, it is clearing of the ""file path"" that the user entered.
    Is it possible to retain the ""file_path"" that the users entered? even if any validations fail?EX: In the following page
    http://apex.oracle.com/pls/apex/f?p=62812:1
    Please
    i)select a valid file from the ""file browse"" item and
    ii)""dont select any select list "" value
    iii) click upload.
    validation will get fired and file path get cleared.
    Thanks

    kumar wrote:
    Thanks for the reply fac...
    fac..just curious to know, what security issue do any one get , if file browse item keeps the ""file path"" they previously selected..The issue is not the server keeping the file "previously selected", but maliciously changing the value to capture a file the user does not intend to submit (e.g /etc/passwd) when the invalid page is resubmitted.
    so every time, when some validation fails, ""user need to reselect that file"".??For their own safety, yes.
    even it is in session state.. for a common user,he feels that it got cleared out and need to ""reselet "" the file again..It's a good practice to clean up any submitted files in APEX_APPLICATION_FILES should any related validations fail.
    Is there any other alternative for this issue? or It is (file browse item) just how it behaves?To ensure a secure and safe web environment it's how it's got to behave.
    Good UI design can be used to minimize the impact on users by isolating file browse items on different pages to items that are prone to validation failure, through the use of multi-page wizards etc.

  • Different issues with file browse item

    Hi everybody,
    I'm trying to create a file upload page using the file browse item. To achieve this I followed the how-to document :
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b16376/up_dn_files.htm.
    I've created my own table to store the documents as I store some extra information.
    When I test this functionality I discovered many issues.
    - If I upload a PDF file this gives me HTTP 404. When I go back, choose the same file with the browse button and upload again this will pass.
    - If I upload a file with spaces in it's name this file will be uploaded twice. (I see the same file two times in the table with 2 different names.
    - At random times I will just arrive at a blank page after clicking the upload button. It appears to me as this will happen more often when I use a double-click to select the file in the browser dialog compared to selecting the file and clicking open. However, I suppose this is just coincidence. It happens in both cases. I'm confronted with the problem with small files (1k, 4k) as well as with larger files (6m)
    - Like I said before, I store some extra information as well. In some cases this information is stored with the document. In some other cases he takes the description from a previous document to store along with the new document. I suppose this is some kind of session problem probably caused by the other problems I currently have and the fact I press back quite often in my browser (each time I arrive at a blank page)
    Version of HTML DB 2.1.0.00.05
    (Included with Oracle 10g express edition)
    I read several posts on this forum before creating my own thread.
    -> I found several discussions about the size of the file but the problem exists for files of 1K as well so I don't see a link with those discussions.
    -> I found several discussions about security and tablespace quota. I granted unlimited tablespace to each and every user : flows_020000, flows_020100, flows_files, htmldb_public_user and the user who is used in the application.
    Tx very much for your help!
    Kris

    Hi Kris,
    I think you're problem is coming from local session info... using the back button is not that good. Put a back button in your application ;-)
    An other thing I wonder is; are you developing and testing on the same machine and at the same time? - I did that before and that gave me some problems. Now I'm developing in Firefox and test with IE or vice-versa.
    Dimitri

  • Modifying File Browse item through Javascript

    I would like to modify the value of a File Browse item with javascript in my Submit button under certain circumstances. I would like to remove the file name (and path) from the File Browse field, so that the file is not automatically uploaded when the Submit button is pressed. It would seem I could "null" out the filename within the javascript function and then follow that with doSubmit ('SUBMIT'). The rest of the page values would be posted to the database, but the file would not get loaded. However, I cannot figure out how to access and modify the filename in the File Browse field with javascript. I've tried using ".value" and ".src" but to no avail. Saw a thread that says there is a bug with File Browse items in versions earlier that 2.2 (I'm using 2.0), and that you needed to fall back on the "p_t xx" notation, but I can't find any information on what that is. Appreciate any help.

    I apologize for the multiple threads. The response to my initial inquiry on thread Inserting/uploading data without inserting/uploading a document was that "others" would be better equipped to help me than the initial responder, so I didn't think I was supposed to continue with that thread. (Haven't used this forum much.) I found a second thread (the one with the "p_tXX" notation, and responded to it, but wasn't sure if all older threads were still active, so I also iniitiated a thread on my own.
    In response to the inquiry about why not using an after submit computation to null out the File Browse item, what I am trying to prevent is the uploading of a file to the WWV_FLOW_FILE_OBJECT$ table, if there is an entry in my File Browse item, when all the user really wants to do is update some data items on the main portion of the page. I have a Apply Changes button on the main data entry form, and then I also have (at my user's request) a separate form and Submit button on the page where the user may enter a file name to upload. The trouble exists when the user is only trying to modify data in the main form, but has also left an entry in the File Browse item. When the page is submitted, the data is uploaded OK, but the file is also uploaded via HTMLDB_APPLICATION_FILES, since there is an entry in the File Browse item. What I'm trying to do, is clear that File Browse item out when the user presses the main form Apply Changes button, so that the file does not get uploaded. The users want the ability to upload a file, but only when that is their direct intent. Obviously, I do not want to clear out the File Browse item under those circumstances. Hope this is clear; sometimes difficult to satisfy the users needs (whims?). Appreciate any help.

  • File in File Browse item disappears if validation fails on any item ....

    Greetings:
    I'm using APEX 4.0. I have a region with 7 data elements, one of them being a File Browse page item. The BLOB file loads in the WWV_FLOW_FILES table first, then in the "After Submit" page processing, I move the BLOB into my own custom table. This works great in normal processing.
    However, if any of the other data elements in this region fails validation, the page renders with the validation messages, but the file in the File Browse page item disappears. Therefore, the user would have to re-select the file to upload before they resubmit and process the page again.
    How can I avoid this? Why does the path and file name disappear when page validation fails?
    Thanks,
    Stan

    bondurs wrote:
    Greetings:
    I'm using APEX 4.0. I have a region with 7 data elements, one of them being a File Browse page item. The BLOB file loads in the WWV_FLOW_FILES table first, then in the "After Submit" page processing, I move the BLOB into my own custom table. This works great in normal processing.
    However, if any of the other data elements in this region fails validation, the page renders with the validation messages, but the file in the File Browse page item disappears. Therefore, the user would have to re-select the file to upload before they resubmit and process the page again.
    How can I avoid this? Why does the path and file name disappear when page validation fails?It is a required security feature. Per the HTML specification, APEX will not render a value in a file browse item on page show. This protects the user from nefarious persons changing the file item value during spurious "failed" validation (hoping the user is distracted correcting the "failed" item and does not notice) in order to capture a file the user does not intend to submit (e.g. /etc/passwd).

  • File Browse Item translation

    Hello all,
    I would like to ask if is possible to translate the "Browse..." button of File Browse item.
    For me it seems that the button cannot be translated to a different language. I have tried to export the XLIFF and there is no string like "Browse...", also I have tried to edit it manually in translation repository, but the string is not present here.
    Any ideas?
    -Jiri

    I think it is decided by the browser itself according to the browser lang
    See
    http://stackoverflow.com/questions/1163667/how-to-rename-html-browse-button

  • File Browse Item in APEX versions prior 4

    Hi there,
    we are currently struggling with a strange issue concerning the File Browse Item in earlier APEX versions: The item value is not submitted correctly when using APEX Listener. There is always a F<randomnumber>/ as prefix that is not visible anywhere in the page source code (so it's not generated by APEX itself) or browser (Firebug trace didn't see any prefix transmitted) and this value is even there when the file browse dialogue is submitted empty. The latter case causes severe problems, as validations fail to detect null values. Our current workaround is a regex on that prefix, but this obviously is no clean solution.
    We found out that F<randomnumber>/ is the prefix of the name that is created temporarily in WWV_FLOW_FILES. If submitted correctly, the name is prefix + actual filename.
    This problem does not occur when using OHS and it does not occur when running the APEX Listener on top of APEX 4.0.2.
    The problem occurs reproducible in the following environments:
    - APEX Listener 1.1.2 standalone or any JEE Container, JDK 1.6.0_26, Linux or Windows
    - APEX 3.1.2 or APEX 3.2.1
    The problem seems to be related to the one discussed in {thread:id=2205973}, but describes some different effect that is not reproducible on OHS.
    I appreciate every clue where this may come from and any hint on how to turn it off...
    Thanks,
    Udo

    Hello Claudio,
    After reading this story, I have same problem with version 1.1 of the apex listener and version 4.1 application express.I still think it affects only versions prior to 4.0. I'm not able to reproduce it on 4.1.
    How do I resolve this problem?I think you ran into a bug in GlassFish 3.1.2. This has been discussed and resolved here: {thread:id=2357381}
    I hope this helps you solve your problem.
    -Udo
    P.S.: Please always open a new thread if you are not sure you are in the same situation and especially when the original thread is long "dead" like this one. Of course you can reference other threads with possibly similar issues in your thread.
    Thanks!

  • Problem with file browse item

    Hello,
    I use a file browse item with storage type WWV_FLOW_ITEMS, but when I select a file, it never appears in WWV_FLOW_ITEMS.
    In an earlier version of apex I had it working fine, but now nothing happens.
    What am I missing?
    We use apex v4.0.2 and a standalone apex-listener v1.1.2.
    Any help would be greatly appreciated.
    Thank you,
    Jos

    user477344 wrote:
    Thanks VC,
    But since I remain in my application to query wwv_flow_files once the file is in wwv_flow_file_objects$, how come I don't get a reply?
    The workspace is still current, not?
    Josquery the table wwv_flow_file_objects$ and make sure the value in SECURITY_GROUP_ID column matched with your current workspace ID

Maybe you are looking for

  • My touchpad won't work

              my hp notebook model dv6z-700 cto, the touch pad is not working, it quit when I    installed a logitech anywhere MX wireless mouse. I want to quit using mouse but the touchpad is gone.                                             ​          

  • Solaris 10 01/06 update CE_PANIC corrupt fs

    It seems Solaris 10 1/6 update, the CE_PANIC call corrupted the fs. I used failsafe mode to rebuilt the super block. One time, even the failsafe mode hang in config. devices. I've to use the install CD, boot to single-user mode in order to repair the

  • Installed Itunes 10.2.1, can't find library & won't recognize mobile device

    I installed the update to 10.2.1 ( not sure why, everything was working just fine) and it gave me an error message that it could not find the library itl. file and was in a music folder location. So, I uninstalled and reinstalled etc. Itunes is worki

  • Coherence3.6  Query Language in  c#  programs??

    I see Building Filters in Java Programs, import com.tangosol.util.QueryHelper QueryHelper.createFilter("homeAddress.state = 'MA' and workAddress.state != 'MA'") use c#,how do I ? no Tangosol.Util.QueryHelper ?

  • Connectivity between BI 7.0 & Thirty party source Data Stage (ETL)

    In 3.x, by specifying Info source in the third party Source system (Data Stage - ETL), we are extracting data to BW system. Now my server is upgraded to BI 7.0. Already existing (i.e. created in 3.x) applications are running fine in BI 7.0. Without I