Home » Developer & Programmer » Forms » why Initial Value cleared by Clear_form(no_calidate);
why Initial Value cleared by Clear_form(no_calidate); [message #156070] Fri, 20 January 2006 11:00 Go to next message
dude4084
Messages: 221
Registered: March 2005
Location: Mux
Senior Member
Hi

I am stuck in following problem.

I have two forms. In one form I have set Initial value of an item to ZERO (o) as per requirement of my project. Now when i press add button on the form, i clear the form by using command clear_form(no_validate). This whole process works perfectly.

Now, in other form, the same method is not working fine. The initial value becomes NULL after the execution of the clear_form(no_validate) command. Which is against my requirement.


In order to resolve the problem, i have Copied the PERFECTLY working item from form no 1 to form no 2 And then adjusted it by changing its column name etc.

even then it didn't work.

Please help me by guiding me that where could be the discrepancy.

Re: why Initial Value cleared by Clear_form(no_calidate); [message #156128 is a reply to message #156070] Sun, 22 January 2006 18:30 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
If your have two things that are the same but behave differently, then something ELSE is different.

Check the validation level of your two forms. Are they different? If the same, then check the block properties.

David
Re: why Initial Value cleared by Clear_form(no_calidate); [message #156321 is a reply to message #156070] Tue, 24 January 2006 12:49 Go to previous messageGo to next message
dude4084
Messages: 221
Registered: March 2005
Location: Mux
Senior Member
Thank u for ur reply

Somehow or the other, i have fixed the problem. I shifted the place of clear_form command and placed it after a procedure call. This procedure was used to change properties (navigable and updateable) of itemspresent on data block.

But at the same time could not figure out the reason of the problem.

It seems to me that

1) Clear_form() acts differnetly if ur control is not in the data block.
2) Similalry, i have change the properties of items in data block through a called procedure. The properties include navigable & updateable. This might be also causing the weired behavior.

Still could not learn from the solution of the problem but at least i am step ahead now in my project.


Some expert may explain the above situation.
Re: why Initial Value cleared by Clear_form(no_calidate); [message #156342 is a reply to message #156321] Tue, 24 January 2006 16:09 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
If you want us to help you learn from this exercise then tell us which triggers you were using and post the code so that we can see what you were doing and are currently doing.

David
Re: why Initial Value cleared by Clear_form(no_calidate); [message #156610 is a reply to message #156070] Thu, 26 January 2006 05:10 Go to previous messageGo to next message
dude4084
Messages: 221
Registered: March 2005
Location: Mux
Senior Member
Hi

I am presenting the the table structre and triggers where beleongs to my problem.

Table involved:

create table prod
(pcode number(3) primary key,
pname varchar2(30),
pack number(2),
ltr number(5,2),
cltr number(5,2),
lesstype varchar2(1),
drate number(7,2),
catID number(2) CONSTRAINT fk_PROD_CAt_catid REFERENCES CAT(catid),
ost number(3),
op number(7,2),
reqty number(3)
);




On Form when i Push ADD Button in order to add a new record in above table through form, then following
THREE things happen



Step-1) Following COde exeucted in when_button_pressed trigger

set_block_property('BLOCK1', insert_allowed, property_true);

clear_form(no_validate);

add_push;




:global.search_value:= NULL;
Select NVL(max(pcode),0)+1
into :block1.pcode
from prod;
go_item('BLOCK1.PCODE');





Step-2) The call to add_push procedure executed the following procedure

add_push
========
PROCEDURE ADD_PUSH IS
BEGIN


Myitem_ENABLE_DISABLE ('BLOCK1', property_true);

set_item_property('bnADD', enabled, property_false);
set_item_property('bnEDIT', enabled, property_false);
set_item_property('bnDEL', enabled, property_false);
set_item_property('bnSAVE', enabled, property_false);
set_item_property('bnCAN', enabled, property_true);

SET_item_property('bnCAN', navigable, property_true);





Step-3) The call to Myitem_ENABLE_DISABLE ('BLOCK1', property_true) executes the following procedure

PROCEDURE Myitem_ENABLE_DISABLE
===============================


PROCEDURE Myitem_ENABLE_DISABLE (blk_name IN char, item_on_off IN Number) IS
NXT_ITEMNAME VARCHAR2(70);
A VARCHAR2(70);
BEGIN
Go_block('Control');
go_item('BNEXIT');
NXT_ITEMNAME := blk_name||'.'||get_block_property(blk_name, first_item);
A:= NXT_ITEMNAME ;
loop

IF get_item_property(nxt_itemname, item_canvas) is not null AND
get_item_property(nxt_itemname, item_type)<> 'DISPLAY ITEM' then
set_item_property(nxt_itemname, ENABLED, item_on_off);
set_item_property(nxt_itemname, updateable, item_on_off);
set_item_property(nxt_itemname, navigable, item_on_off);

end if;

NXT_ITEMNAME := blk_name||'.'||get_item_property(NXT_ITEMNAME, next_navigation_item);


if (NXT_ITEMNAME= blk_name||'.ROWID') then
exit;
end if;

end loop;


END;


==============================
==============================

SO basically i aceived my objective by shifting clear_form(no_validate); after add_push; in step-1 i.e.



add_push;

clear_form(no_validate);


I hope that now you will be able to come some conclusion.
Re: why Initial Value cleared by Clear_form(no_calidate); [message #327561 is a reply to message #156070] Mon, 16 June 2008 22:36 Go to previous messageGo to next message
white_phoenix
Messages: 19
Registered: November 2007
Junior Member
Hi,

I have another issue regarding clear_form.

After I pressed a button, when the system.mode = 'NORMAL', it should do clear_form. However not all fields in the form will be cleared.

Fields that are not clear are non-database item.

Any help??

IF :System.Mode <> 'NORMAL' THEN
		EXIT_FORM;
	ELSE
		CLEAR_FORM(NO_VALIDATE);
	END IF;


I already debug the form, it's currently system.mode = 'NORMAL'
Re: why Initial Value cleared by Clear_form(no_calidate); [message #327773 is a reply to message #156070] Tue, 17 June 2008 09:15 Go to previous messageGo to next message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
dude4084 wrote on Fri, 20 January 2006 18:00

In one form I have set Initial value of an item to ZERO (o) as



could you give us the name of that item
Re: why Initial Value cleared by Clear_form(no_calidate); [message #327794 is a reply to message #156070] Tue, 17 June 2008 12:36 Go to previous messageGo to next message
dude4084
Messages: 221
Registered: March 2005
Location: Mux
Senior Member
29 months has passed now so could not remember exact details of the problems.

sorry

-Dude
Re: why Initial Value cleared by Clear_form(no_calidate); [message #327869 is a reply to message #156070] Wed, 18 June 2008 04:17 Go to previous message
Martin Eysackers
Messages: 80
Registered: October 2005
Location: Belgium
Member
ooh yes I'm sorry I wast just looking at the date of the post just before mine by white_phoenix Smile

white_phoenix please make a new post
you're confusing people Smile
Previous Topic: migration
Next Topic: how to use cursor within a form
Goto Forum:
  


Current Time: Sun Dec 04 18:43:51 CST 2016

Total time taken to generate the page: 0.14240 seconds