Home » Developer & Programmer » Forms » Oracle Forms - Enable Disable Textbox Based On Radio Button Selection (Oracle Forms)
Oracle Forms - Enable Disable Textbox Based On Radio Button Selection [message #659397] Sat, 14 January 2017 19:49 Go to next message
Saket_7
Messages: 4
Registered: January 2017
Junior Member
We have 3 Radio Buttons in a Radio Button Group and Text item beside the Second Radio Button.
The Text Item should be only enabled when the Second Radio Button beside it is selected and disabled when anyone of the other Radio Buttons is selected.
The text item can only have 'Yes' or 'No' values, if the user enters any other text value, a message should be displayed to the user saying cannot enter any other values. The Default value is 'Yes'. The Table Column for this Text item has some NULLs and the remaining 'Yes'.

Based on the value entered in the Textbox, the table column should have the value 'Yes' or 'No' inserted or updated accordingly.

I'm currently using When_Radio_Changed, When_Validate and Post_Query Triggers, please let me know if any other triggers need to used to achieve this functionality.


Re: Oracle Forms - Enable Disable Textbox Based On Radio Button Selection [message #659400 is a reply to message #659397] Sun, 15 January 2017 00:42 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
That seems to be OK.

However, you might create a list of values which returns "yes" and "no" and set text item's property which won't let users enter any other value. Doing so, it is obvious which values are valid.

Furthermore, create a column CHECK constraint which allows only these two values; use the ENABLE NOVALIDATE option so that existing column values (nulls, right?) wouldn't cause problems.

No further objections so far.
Re: Oracle Forms - Enable Disable Textbox Based On Radio Button Selection [message #659401 is a reply to message #659400] Sun, 15 January 2017 02:13 Go to previous messageGo to next message
Saket_7
Messages: 4
Registered: January 2017
Junior Member
Thank you for your help and suggestion, I was thinking that I need to include some code in Pre-Insert and Pre-Update Triggers, if I will have to use the Text item (which is already existing on many Forms with similar requirement).
Re: Oracle Forms - Enable Disable Textbox Based On Radio Button Selection [message #659402 is a reply to message #659401] Sun, 15 January 2017 04:41 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If text item is a database item (which means that block it belongs to is a database block, i.e. based on a table), then you don't add any additional code (such as PRE-INSERT or PRE-UPDATE triggers) as Forms does such things automatically.

However, if it is not, you will have to write your own code The question - in that case - is: why would you do that? If possible, use as many built-in functionalities as possible as they make your life quite easier.
icon14.gif  Re: Oracle Forms - Enable Disable Textbox Based On Radio Button Selection [message #659403 is a reply to message #659402] Sun, 15 January 2017 09:26 Go to previous messageGo to next message
Saket_7
Messages: 4
Registered: January 2017
Junior Member
Thank you, I really appreciate your help. I've not been working with Forms since long time. I was thinking the same that it should be taken care by the Forms but just wanted to make sure that it is handled by Forms and therefore was thinking to include pre-insert and pre-update triggers as an additional check.

Just in case, it doesn't work, I'll check the built-in functions that can accomplish this.

Thanks again.

[Updated on: Sun, 15 January 2017 09:28]

Report message to a moderator

Re: Oracle Forms - Enable Disable Textbox Based On Radio Button Selection [message #659404 is a reply to message #659403] Sun, 15 January 2017 10:15 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Uh, no - if you include PRE-INSERT, you'll either get DUP-VAL-ON-INDEX (if there's the unique key index/constraint) or silently insert a duplicate if there's no such a constraint because you'll (try to) insert another "copy" of the same record that Forms already inserted in its default processing.

As I've said: if you create a data block using Forms Wizard, there's nothing else you have to do - you'll be able to insert, update, view (query) and delete records without a single line of code - that's the "built-in" processing I was talking about.

However, if you want to make a form fancy (everyone usually does), then you might need to write additional code - just make sure not to collide with what Forms does itself.
Re: Oracle Forms - Enable Disable Textbox Based On Radio Button Selection [message #659405 is a reply to message #659404] Sun, 15 January 2017 10:56 Go to previous message
Saket_7
Messages: 4
Registered: January 2017
Junior Member
Got you, thank you. The data is being populated in the Data Block from a Table, which Insertable, Updateable and Deletable options set.

I'm thinking I will need to set the ENABLED/DISABLED property of the text item each time when navigating from one record to another one by using a WHEN-NEW-RECORD-INSTANCE trigger because I believe the text item ENABLED/DISABLED can only be done at item level, but NOT at item instance level.

Also to not include a POST-QUERY Trigger as this is a Database item.
Previous Topic: Calendar Issue in multiple records in oracle 10g
Next Topic: Enabling all the chec kboxes when block is loaded in forms
Goto Forum:
  


Current Time: Thu Mar 28 17:54:43 CDT 2024