Home » Developer & Programmer » Forms » can key-commit re-check the input value? (oracle forms 9i + windows xp)
can key-commit re-check the input value? [message #363038] Thu, 04 December 2008 22:12 Go to next message
kevin_ye
Messages: 37
Registered: December 2007
Location: Shanghai,China
Member
There are empno, ename, job, sal and others information on form, and require:
(1) empno is not allowed null, and not duplicate
(2) ename is not allowed null.

I want to check the input value(even no input) valid or not before save, so I use serveral procedure to check in key-commit trigger. but there is a problem:
if empno is null first, and i click save button, it would pop-up a failure message; but after i input a valid value, then click the save button again, it still pop-up the failure message.

the value is valid, why key-commit trigger doesn't recall the procedure? if recall, let it pass, not pop-up the failure message again.

any suggestion will be appreciated.

------------------------------------------------------------

validate_emp_id_YN: validate empno
procedure validate_emp_id_YN IS
  cursor cu_emp_count(in_emp_id varchar2) is
    select count(*) from scott.emp 
    where empno=in_emp_id;
	lv_count number;
begin
  if :emp.empno is null then
  	message('empno error');
    message('empno cannot null',acknowledge); 
    raise form_trigger_failure;
  else
  	open cu_emp_count(:emp.empno);
  	fetch cu_emp_count into lv_count;
  	close cu_emp_count; 
  	if (lv_count>0) then
  		message('empno error');
      message('empno duplicate',acknowledge); 
      raise form_trigger_failure;
	  end if;
  end if;
end;



validate_emp_id_YN: validate empno
procedure validate_emp_name_YN is
begin
  if :emp.ename is null then
  	message('ename error');
    message('ename cannot null',acknowledge);
    raise form_trigger_failure;
  end if;
end;


key-commit trigger:
validate_emp_id_YN;
validate_emp_name_YN;


  • Attachment: scott2.fmb
    (Size: 52.00KB, Downloaded 157 times)
Re: can key-commit re-check the input value? [message #363039 is a reply to message #363038] Thu, 04 December 2008 22:44 Go to previous message
kevin_ye
Messages: 37
Registered: December 2007
Location: Shanghai,China
Member
sorry, i made a logic mistake.
in fact, the code runs well.
Previous Topic: Executing Query through parameter
Next Topic: how to get REMOTE IP ADDRESS
Goto Forum:
  


Current Time: Mon Dec 05 15:20:11 CST 2016

Total time taken to generate the page: 0.10166 seconds