-2

Im not sure if this is possible or not in Oracle Apex. Essentially what we have is a textbox field on the opportunity form where folks can put in some free form notes about the opp. I'm looking to see if there is a way to have the current date populate into the text field when the user clicks into the field to add some notes.

Please Advise,

Thanks

CoffeeTableEspresso
  • 2,614
  • 1
  • 12
  • 30

1 Answers1

1

Suppose item's name is P36_TEXT. Create dynamic action

  • Event: Mouse button press
  • selection type: item
  • item: P36_TEXT

True action:

  • execute server-side code

  • language: PL/SQL

  • code:

    :P36_TEXT := to_char(sysdate, 'dd.mm.yyyy hh24:mi:ss');
    
  • items to return: P36_TEXT

That's it; run the page. When you click into that item, dynamic action will populate it with current date/time.

Tested on apex.oracle.com, running Apex 20.2.

Littlefoot
  • 131,892
  • 15
  • 35
  • 57
  • Thanks for your answer, it is working but just an issue, my customer needs to add comment every day, in this way when you click into this item, the previous comment is gone and the current date populate instead, how I can keep the previous comments. – Mali Shariat Jan 05 '21 at 19:36
  • Seems like your requirements were not clear; you will want to edit your question to state what you want to happen. Are all fields updatable? Just the comments field? Do you want all previous comments to be saved in one big happy textbox? (Not a good idea...) – Mark Stewart Jan 05 '21 at 19:57
  • :P2_NOTES := :P2_NOTES || chr(13) || to_char(sysdate, 'dd/mm/yyyy'); – Mali Shariat Jan 05 '21 at 20:03
  • in this way I keep the all previous comments and for the new comment it is going next line with current date – Mali Shariat Jan 05 '21 at 20:05
  • Anyway, Thanks for your response, it was very helpful. – Mali Shariat Jan 05 '21 at 20:43