Home » Developer & Programmer » Forms » Deselect all checkboxes except the one which has been selected (Oracle forms )
Deselect all checkboxes except the one which has been selected [message #410825] Tue, 30 June 2009 08:19 Go to next message
parag_narkhede
Messages: 110
Registered: January 2008
Location: Pune
Senior Member
Hello All,

I have multi record block and a select checkbox in that block.
My requirement is whenever I select any checkbox all other checkboxes should get deselected except the one which I have selected just now.

Example: I started from first item (checkbox).
I select first checkbox and when I will select second checkbox, then 2nd should get checked but all other checkboxes should get unchecked.

Re: Deselect all checkboxes except the one which has been selected [message #410858 is a reply to message #410825] Tue, 30 June 2009 13:19 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
My requirement is whenever I select any checkbox all other checkboxes should get deselected except the one which I have selected just now.

In that case, use radio buttons instead.
Re: Deselect all checkboxes except the one which has been selected [message #410859 is a reply to message #410858] Tue, 30 June 2009 13:41 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Though, here's one way to do that - loop through all records and uncheck all checkboxes except the current one (basically, there can be only two checkboxes that are checked at a time: previous and current one).

declare
  l_current_record number;
  l_last_record    number;
begin
  l_current_record := :system.trigger_record;

  last_record;
  l_last_record := :system.cursor_record;
  
  first_record;
	
  for i in 1 .. l_last_record loop
    if :system.cursor_record <> l_current_record then
       :cb_checkbox := 0;
    end if;
    next_record;
  end loop;
  
  go_record(l_current_record);
end;
Re: Deselect all checkboxes except the one which has been selected [message #410910 is a reply to message #410859] Wed, 01 July 2009 00:57 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
As only one checkbox can be selected at a time, you can test to see if a control block item is set, if it is then you keep a copy of that value, check the current check-box, store the current row in the control block item, go to the row that had been stored, uncheck that box and then come back to this row.

David
Re: Deselect all checkboxes except the one which has been selected [message #413013 is a reply to message #410825] Tue, 14 July 2009 00:09 Go to previous messageGo to next message
parag_narkhede
Messages: 110
Registered: January 2008
Location: Pune
Senior Member
Above code, solved my problem. Thanks to all.
Re: Deselect all checkboxes except the one which has been selected [message #442461 is a reply to message #410859] Mon, 08 February 2010 04:49 Go to previous messageGo to next message
ghadeer
Messages: 25
Registered: February 2010
Location: ksa
Junior Member
Hi ,
please where can I use this code,I mean in which trigger????????

[Updated on: Mon, 08 February 2010 04:52]

Report message to a moderator

Re: Deselect all checkboxes except the one which has been selected [message #442462 is a reply to message #410825] Mon, 08 February 2010 04:54 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
WHEN-CHECKBOX-CHANGED would seem to be the obvious choice.
Re: Deselect all checkboxes except the one which has been selected [message #442470 is a reply to message #442462] Mon, 08 February 2010 05:39 Go to previous messageGo to next message
ghadeer
Messages: 25
Registered: February 2010
Location: ksa
Junior Member
Hi can you explain me this line
:cb_checkbox := 0;
is that the name of checkbox ,but I have nine checkboxs with different name
Re: Deselect all checkboxes except the one which has been selected [message #442471 is a reply to message #410825] Mon, 08 February 2010 05:42 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
This code works on the assumption that you've got one checkbox repeated over multiple blocks. I've already pointed out in the other thread that it doesn't match your requirement.
Previous Topic: Use M.S Sql Server Database with Forms 6i with out oracle database install
Next Topic: how to stop from inserting if condition not met
Goto Forum:
  


Current Time: Fri Sep 20 09:35:01 CDT 2024