Question

i am currently writing an apolication in ORACLE APEX, i am writing some validation on a login so that when you enter your username and password and click submit it will check to see whether you have changed your password,if yes then it will direct you to the main front page however if not i want it to link to a change password page, i currently have some code which looks like:

BEGIN
  FOR c1 IN (SELECT user_name FROM wwv_flow_users) LOOP
    IF APEX_UTIL.CHANGE_PASSWORD_ON_FIRST_USE(p_user_name => c1.user_name) THEN
      htp.p('User:'||c1.user_name
            ||' requires password to be changed the first time it is used.');
      /*f?p=&APP_ID.:8:&SESSION;*/
    END IF;  
  END LOOP; 
END

however i am unsure as to how correct this is, as I am rather new to the topic, this is what i have picked up from looking at oracles API's and from looking round other sources to try and come to a successful conclusion.

Any help would be greatly appreciated

Many thanks

J

Was it helpful?

Solution

You're mixing two different Apex features: validations and branches.

If you want to check for a data entry error, you use a Validation - and generally the same page will be returned to the user so they can correct their error.

If you want to branch to another page, you use a Branch. If you want to branch to different pages depending on a condition, you can create multiple Branches, each with a condition. The first branch that satisfies its condition will be used.

In addition, if you want to do some processing before the branch, you create a Process. Typically a Process is run after the validations are done but before the branches are done.

In your case, you could put your code in a Process, and set a hidden item with a flag that is used by the Branches to work out which page to branch to.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top