This content has been marked as final. Show 6 replies
The error unfortunately isn't terribly helpful...well, not to me at least:
Message: Exception thrown and not caught
I should probably add that our Apex version is 4.1 on 11gR2
Bit of an update:
I rebuilt the DA as the following:
Event: Lose Focus
Selection Type: Item
Event Scope: bind
Action: Set Value
Fire On Page Load: unchecked
Set Type: PL/SQL Function Body
Page Items to Submit: P3_PO_REF_NUMBER
declare l_exists number; l_valid varchar2(2); begin select count(*) into l_exists from PO_LINE where BUSINESS_UNIT = 'METRO' and (PO_ID = to_char(:P3_PO_REF_NUMBER,'FM0000000009') or PO_ID = 'S'||:P3_PO_REF_NUMBER); if l_exists > 0 then l_valid := 'V'; else l_valid := 'NV'; end if; EXCEPTION WHEN OTHERS THEN l_valid := 'NV'; return l_valid; end;
Selection Type: Item
The idea is to have P3_VALID as a hidden field and to create another DA to hide/show a DOM element based on this fields value.
However, as noted above, this DA is breaking.
Using Firebug, I was able to get this info:
SyntaxError: JSON.parse: unexpected character apex_4_1.min.js (line 16)
I can't determine what is being passed that it doesn't like...Any thoughts would be welcome
You are right, so I changed my code up to:
But still getting the same JS error.. :(
DECLARE l_exists number; l_valid varchar2(2); BEGIN select count(*) into l_exists from PO_LINE where BUSINESS_UNIT = 'METRO' and (PO_ID = to_char(:P3_PO_REF_NUMBER,'FM0000000009') or PO_ID = 'S'||:P3_PO_REF_NUMBER); if l_exists > 0 then l_valid := 'V'; else l_valid := 'NV'; end if; RETURN l_valid; EXCEPTION WHEN OTHERS THEN RETURN 'NV'; END;
Ok, just for closure. I did get this working.
I ended up deleting the original P3_PO_REF_NUMBER item and recreated it, and everything began to work. As I was doing this, I noticed that it seemed like things would begin to go awry when I changed the item's name, even if I changed it back again. It was almost as if there was an associated between the DA that became corrupted once the item name was changed. If I took the item out of the page items to submit field, no error. Of course the DA wouldn't fire correctly then either because it wasn't getting any value changes, but when I added the item back into the page items to submit field, I go an error.
When I created the second PO_REF_NUMBER item, I did not delete the original first, so the new one of course had to be named differently. Then I modified the DA to use the new item name (PO_REF_NUM). It worked! Cool. So, no wanting to get rid of the original yet, I rename it, and then renamed the second one to what the original was (I have other code using that item name). Then I changed the DA again...but now it failed - unless I blanked out the page items to submit field...
3rd time is a charm. So, this time, I made sure that no items were named "PO_REF_NUMBER", then I created the PO_REF_NUMBER again, naming it exactly as I needed it to be so I wouldn't have to change it later. Then I set out to tweak the field (size, etc), but did not touch the name. Now my DA is working nicely! It sets a hidden field's value, then another DA shows or hides an icon based on that hidden field's.
Hopefully someone will find this useful,