Home » Developer & Programmer » Forms » select all check boxes (forms6i)
select all check boxes [message #517971] Sat, 30 July 2011 05:59 Go to next message
rajendaroracle
Messages: 80
Registered: May 2011
Location: India
Member

Hi,

I want to put one check box to check all the check boxes.how can i do this?

regards,
rajendar
Re: select all check boxes [message #517983 is a reply to message #517971] Sat, 30 July 2011 10:32 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Put "Select all" checkbox into a control block. When you check that "select all" checkbox, loop through all records in a tabular (data?) block and set all checkboxes to "checked".
Re: select all check boxes [message #517989 is a reply to message #517983] Sat, 30 July 2011 13:54 Go to previous messageGo to next message
rajendaroracle
Messages: 80
Registered: May 2011
Location: India
Member

Hi,
As you said I have written like this but only one check box is selected.

BEGIN
  WHILE :SYSTEM.LAST_RECORD='TRUE' LOOP
  IF :CONTROL.SELECT_ALL = 'Y' THEN
  		
		GO_BLOCK('XX_TEST_DBBLOCK');
	 
		FIRST_RECORD;             
		:XX_TEST_DBBLOCK.REQUISITION_CHECKBOX := 'Y';
		
	ELSIF :CONTROL.SELECT_ALL = 'N' THEN
		GO_BLOCK('XX_TEST_DBBLOCK');	
		FIRST_RECORD;
		:XX_TEST_DBBLOCK.REQUISITION_CHECKBOX := '';
		
		END IF;
		NEXT_RECORD;
	END LOOP;
END;
Re: select all check boxes [message #517992 is a reply to message #517989] Sat, 30 July 2011 15:41 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Read what you wrote, in plain English.
loop while a condition is met
  If SELECT ALL is checked
     go to tabular block
     position to its first record
     check the first record's checkbox
  else
     go to tabular block
     position to its first record
     unckeck the first record's checkbox
  end if
  go to next record
end loop

You are now in the second record. This is what you do next:
  If SELECT ALL is checked
     go to tabular block
     position to its first record
     check the first record's checkbox
  else
     go to tabular block
     position to its first record
     unckeck the first record's checkbox
  end if
  go to next record

You are again in the second record. And the circle goes on and on.

Perhaps you should first write pseudo-code; once you are satisfied with it, write "real" code.

Also, please, read (again) this message.
Re: select all check boxes [message #518027 is a reply to message #517992] Sun, 31 July 2011 17:54 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Also, why this:
WHILE :SYSTEM.LAST_RECORD='TRUE' LOOP

Under what circumstances is that true?
Re: select all check boxes [message #518034 is a reply to message #518027] Mon, 01 August 2011 00:04 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK then, here's how you might try to do that; adjust object names that don't match your own.

if checkbox_checked('buttons.cb_select_all')
then
   -- SET ALL CHECKBOXES
   go_block('tabular_block');
   first_record;
   
   loop
     :tabular_block.cb_checkbox := 1;
   	  
     if :system.last_record = 'FALSE' then
        next_record;
     else
        exit;
     end if;
   end loop;
   
elsif <fill in the code which would remove all checks>
Previous Topic: FRM-40738: Argument 1 to builtin GO_RECORD cannot be null.
Next Topic: calendar LOV postion(x,y) on forms 6i
Goto Forum:
  


Current Time: Sun Sep 08 23:02:53 CDT 2024