How to prevent deletion in a form ?

I need to prevent deletion in a form if the starting date <= SYSDATE and show an alert .
How do I implement this please ?
My date field is of type timestamp , it's "id2"
I have added the following method in my backing bean :
    public String preventDel() {
long toDateAsTimestamp = id2.getTime();
long currentTimestamp = System.currentTimeMillis();
long getRidOfTime = 1000 * 60 * 60 * 24;
long toDateAsTimestampWithoutTime = toDateAsTimestamp / getRidOfTime;
long currentTimestampWithoutTime = currentTimestamp / getRidOfTime;
if (id2 < currentTimestampWithoutTime )
System.out.println("Display report.");
//how to show the alert ?
return null;
Any help please ?

Hi girl.
If i were you this is how I would do it;
1.- Create a transient attribute in your VO called ToBeDeleted of type boolean and assign its value as the following expression "StartingDate <= adf.currentDate".
2.- Expose the attribute in your bindings. Then, in your delete button you can:
     - Disable it if ToBeDeleted is not true.
     - In the description of the button you could put a message that it cant be deleted.
OR
     Use your java class to show the message. But the alert should be thrown as a facesMessage of type Error: look at this How to show af:message programatically
Also, I would like to say that none of this might be the best way to implement your use case. For the sound of it you have a business rule that should be implemented in your model project if you don't want to break the MVC pattern. (This is that you shouldnt be able to delete the row using your AppModule tester if the startingDate <= Sysdate, for example).
Hope this helps.

Similar Messages

  • How to prevent Autoquery in infobus forms

    Hi,
    When an info bus form comes up, it queries the data from the
    table and shows it up. I want to prevent this. How do I do this?
    In jbcl QueryDataSet there was a parameter to specify this
    behaviour. But nothing is seen in infobus documentation. Can
    someone help me please.
    I tried using rowsetInof.publishSession(false). Still the data
    gets quried, only thing is that it is not shown on the
    components. I want to prevent the initial querying totally.
    TIA,
    --Gopal
    null

    Hi
    Thanx. But it doesn't help. When I use
    sessionInfo.publishSession(false),
    if I have 10 rows in the table, it shows 10 blank rows on the
    Grid control to which the rowSet is attached. Moreover, it does
    not allow me to add any values to them. (It allows any value to
    be inserted, but just doesn't save and no validation events
    take place.)
    So I need more help on this.
    Thanks,
    --Gopal
    Dave Henley (guest) wrote:
    : I'm using
    : sessionInfo.publishSession(false);
    : in the init method of my infobus form and it works fine.
    : Gopal (guest) wrote:
    : : Hi,
    : : When an info bus form comes up, it queries the data from the
    : : table and shows it up. I want to prevent this. How do I do
    : this?
    : : In jbcl QueryDataSet there was a parameter to specify this
    : : behaviour. But nothing is seen in infobus documentation. Can
    : : someone help me please.
    : : I tried using rowsetInof.publishSession(false). Still the
    data
    : : gets quried, only thing is that it is not shown on the
    : : components. I want to prevent the initial querying totally.
    : : TIA,
    : : --Gopal
    null

  • How do you delete the submit form

    How does one get rid of the submit button when creating a form in Acrobat?  When I create the form, I then click Distribute form and in that process the submit button is attached to the form.  I don't want that button on the form.
    Mahalo,
    Ms Moore

    OK, just don't distribute the form then and the submit button won't be displayed. In saying this I'm assuming you have a copy of the form before you distributed it. If not, you can save a copy (File > Save a Copy) and I think that will take care of it, though you may have to delete some other (somewhat hidden) stuff in the document.
    If the form needs to be filled and saved by Reader users, then you will have to Reader-enable the form. This is done automatically when you distribute a form, but you can do it separately by selecting in Acrobat 10: File > Save As > Reader Extended PDF > Enable Additional Features
    If you're using Acrobat 9, you'd select: Advanced > Extend Features in Adobe Reader

  • How can i delete a passcode form my iphone?

    i have a find my phone passscode on my iphone but i creates it to much trouble so i want to delete the passcode,how can i do that?

    Settings > General > Passcode Lock
    Enter your passcode and then turn it off.
    Don't lose your phone!

  • How do I delete a station form iTunes Radio?

    I need help deleting a station from my itunes radio! If anyone knows how to do that I would apprecaite the help.
    Thank you!

    Like you I can't delete stations in iTunes Radio.  There is no edit option.  I tried long clicking but this only brought up station. Help. Ios7 di

  • HT2476 how do you delete an aplication form my laptop

    i wish to delete an aplication from my  macbook pro

    old grumpy wrote:
    i wish to delete an aplication from my  macbook pro
    Uninstalling applications
    If the application has an uninstaller use that. 
    If not... drag it to the trash and... Empty the Trash

  • How can I delete the image in Forms 6i?

    How can I delete/clear the image item in Forms 6i which is a database item?
    and I want to create a report that print the information if the record has been stored a image. so how can I do that?
    Thx~

    In forms 6i + , Clear_Item should clear the image from the item. For earlier versions See note 139900.1 on Metalink

  • How can I prevent deleted mail from ending up in "All Mail"     and "Archives"?  To my horror, I've emptied these boxes and lost all my mail from all my boxes  (and why do I need to enter this question three times?"

    How can I prevent deleted mail from ending up in "All Mail" and "Archives"? 
    To my horror, I emptied these boxes and lost all my mail from all my boxes .
    All mail also disappeared from my iPad, I suppose because they are "synched"
    (Also, no offense, but why do I need to enter this question multiple times?)
    Thanks for any thoughts.

    I'm having a similar but slightly different problem. My company just migrated to Gmail, and it's saving mail drafts every 30 seconds into my Trash folder.
    I unchecked the "Show in IMAP" preference in the Gmail settings, but my Drafts folder completely disappeared. I went back and checked it and the folder reappeared (with my drafts still in there).
    I like the idea if starting an email on my laptop and having the option of finishing it on my iPhone or iPad, so only saving Drafts locally would not be ideal.

  • I am trying to sync music from my iTunes library on my iMac to my iPhone. I only want selected music but I'm getting unwanted songs. How can I delete those songs on my iPhone or how can I prevent these unwanted songs that have not been selected from appea

    I am trying to sync music from my iTunes library on my iMac to my iPhone. I only want selected music but I'm getting unwanted songs. How can I delete those songs on my iPhone or how can I prevent these unwanted songs that have not been selected from appearing on my iPhone? Help!

    http://support.apple.com/kb/HT1296

  • TS3276 On received mail, I delete sender's name, address, etc. then forward it.  The forwarded mail has a duplicate of the original mail, show original sender's name, etc.  How to prevent the duplicate from being sent?

    How to prevent duplicate of orginal mail (with original sender's name, address) being "attached" when forwarded?

    Maybe I am mis-understanding what you are seeing.
    When I forward a message, the receiver will see the original mail (unless I edit it, such as removing any previous sender's information) and the length will be the same as the message was before forwarding except for the added line "Begin forwarded message" (again, unless I edit bits out), and there will be no attached copy of the original message.
    So when you say in your reply above "The orginal email with the sender's name and address was also sent with my forwarded email." do you mean:
    a) that it is still visible at the head of the text of the message (which I was saying does not happen for me because "after hitting delete, the previous sender's information disappears." [and since] "it has disappeared, it cannot be in your forwarded mail." Disappeared means it is not there.
    b) another copy of the original message is attached to the forwarded email at the end, either as an included file or as repeated text.
    c) some other situation.
    Sorry about the previous mis-spellings! I hope that we can get to the bottom of this.

  • How can i prevent deleted application download on my iTune Store?

    Hi,
    i downloaded few application and deleted in my iPhone 4 (before connect iTune store) but whenever i connect my iPhone in iTune store deleted applications start downloading every time so how can i prevent deleted application download on my iTune Store? please suggest me,
    Thanks in Advance,
    Suresh Balakrishnan.

    Welcome to the Apple community.
    It sounds as though you are sharing and iCloud account with someone else, you need to have a separate iCloud account, otherwise there is no way of stopping other sharers from accessing your photos in photo stream.

  • Each song on my iTunes has a duplicate. How do I delete all duplicates and prevent this from happening again in the future?

    Each song on my iTunes has a duplicate. How do I delete all duplicates and prevent this from happening again in the future?

    After I had updated to Itunes 11 (also on Windows 7), I had the same experience, but I suspect that it was because I accepted a proposal to set up an external media library in order to simplify security backups. An associated result was that I had lost all of my playlists!
    What I did was to restore the entire library off my Ipod, using a very good program called PodToPC (a free download is available) selecting an option to replace all of the stuff in the Itunes library. I use the Ipod Classic simply because it has a large capacity to hold my collection of CD and Vinyls. No way was I going to modify duplicates of 10000 tracks in 750 playslists by hand!  I did have a few residual problems with some of the playlist specs but, after a few hours of work all was restored.
    I hope this is useful.

  • How to disable edit.delete in oracle forms 11i?

    i was able to use APP_SPECIAL.ENABLE('EDIT.CLEAR',PROPERTY_OFF); to disable the clear button but also want to disable delete button,
    i added the APP_SPECIAL.ENABLE('EDIT.DELETE',PROPERTY_OFF); in the pre_block and pre_query trigger but not able to disable the delete item from edit menu.
    Am i doing sometjhng wrong?

    Hi;
    Please check
    How to disable delete button in a form
    How to disable delete button in a form
    Regard
    Helios

  • How do you delete a form?

    How do you delete a form?

    In "My Forms"  select the form you want to delete and click on the delete button in the toolbar.
    Gen

  • Our daughter figured out on her own how to delete songs and apps from her IPAD2. Her parents would like to know how to delete such files and then how to prevent our daughter from doing it.

    Our daughter figured out on her own how to delete songs and apps from her IPAD2. Drives us crazy since we continually have to reload these files. Her parents would like to know
    1. how she did it (delete files) and
    2. how to prevent her from deleting files in the future.

    http://support.apple.com/kb/ht4213

Maybe you are looking for

  • HT5517 My daughters phone works on airplay but I can't get mine to work

    Just bought Apple TV, and can't get my iPhone 5 c to mirror.  My daughter has tried and it works on her phone but but not on mine or my iPad.  Please help.  My wife has tried her iPhone and she can't mirror either

  • XAResource.XAER_RMFAIL start() failed on resource

    We are getting following error in production system. What may be the cause of this issue? com.ekaplus.common.exception.SystemException: java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResour

  • Need for new Camera?

    I currently have a Sony Digital Handycam (DCR-TRV140) that i like, and has worked well for what i've wanted (home movies, etc). However, the camera is 6 years old and i'm wondering how outdated the technology is and if i should get a new camera? We'r

  • Live recording with iPod?

    Hi - Someone I met boasted he could plug a stereo microphone (a Sony model, with a 1/8" plug) into his 60GB model (an older one, whichever generation had an 1/8" input) and with no hacking/wizardry/voodoo could record directly to the unit. 1) Was he

  • Applet won't run on the IIS Server/...

    I have a very simple applet which connects to my Personal Oracle 8... When the applet starts on the web browser, it gives me this message... Any ideas??? Any help would be great... Java(TM) Plug-in: Version 1.2.2.px Using JRE version 1.2.2 User home