APEX-AT-WORK no image
Tags:

Tabular Form - Validation issue

Von Tobias Arnhold 6.28.2012
I'm currently have some questions about TABULAR FORM validations. I my questions inside the APEX forum: https://forums.oracle.com/forums/thread.jspa?threadID=2407939
Questions:
1. I only want that a select list entry get selected ones not several times. It must be some kind of validation check. Is there any example available?
2. If a select list value is already set within a row then this id should not be displayed in any other row anymore.

For question one I found an answer myself. This is a validation based on the idea from Denes Kubicek.
-- Validation of Type: Function Returning Error Text 

DECLARE
   l_facility_ids varchar2(32000);
   l_facility_bez varchar2(200);
   l_error   VARCHAR2 (4000);
BEGIN
   FOR i IN 1 .. apex_application.g_f07.COUNT -- select list with facilities
   LOOP
      IF instr(':'||l_facility_ids||':',':'||apex_application.g_f07(i)||':')>0
      THEN 
         select description into l_facility_bez from facilities where id = apex_application.g_f07(i);
      
         l_error :=
               l_error
            || '</br>'
            || 'Row '
            || i
            || ': facility"' || l_facility_bez  ||'" is already selected.'; 
      END IF;

      l_facility_ids := l_facility_ids ||':'|| apex_application.g_f07(i);
   END LOOP;

   RETURN LTRIM (l_error, '</br>');
END; 
Is there an workaround for question two available?

Post Tags: