nodehep223
nodehep223

Reputation: 33

How to enable submit button based on validate button in Oracle APEX

I am searching for this every where no one is able to help me.

Only this is the one hope left for me

Below is my scenario and components I have used

*  1 file browse button - To select file 
*  2 buttons 
     first  button 1 is for validating 
     second button 2 is for submitting 

Below is my GUI designed in Oracle APEX

GUI

Note :

On page load my submit button is disabled initially - it cannot be clicked. On that submit button I have written PL/SQL code in backend as dynamic action

So my aim is to achieve step 3

Step 1 : I will choose file using file browse button

Step 2 : After selecting my file I will click VALIDATE button.

Once I click on validate button my dynamic action will get trigger which is written in JavaScript.

This Java script checks the file choosen is empty or not and return true or false

Sample code :

  if ( file is empty ) 
  {
    return false     
  }
  else
  {
    return true
  }
 

Step 3 : Once my Validate return true my Submit button should get enabled and After its enabled and once I click on submit button my PL/SQL code should run

I ask every one over YouTube no one as respond me

Upvotes: 0

Views: 1295

Answers (1)

Littlefoot
Littlefoot

Reputation: 142743

From my point of view, I'd remove the "Validate" button entirely.

  • modify validation so that it doesn't return TRUE/FALSE, but e.g. Error Text so that - if file is empty - validation displays appropriate message and stops further execution
  • leave the "Submit" button as is; it should just submit
    • if validation failed, nothing would be submitted
    • otherwise, it would

Alternatively, if you want to keep the "Validate" button, create dynamic action on it with several steps:

  • see if that JavaScript can set hidden item's value to e.g. "true" or "false" (I can't assist with that, I'm not good at JavaScript at all) (that's "Set Value" dynamic action) (initially, on page load, set it to "false")
  • presume you managed to do that; next dynamic action step would be "Show" which shows the button if "Client side condition" is met, and that's if hidden item's value is "true"
  • the next step is "Hide"; its "Client side condition" is just the opposite, i.e. if hidden item's value is "false" (make it run at page initialization as well, so that the "Submit" button is initially hidden)

That would be it, I guess.

Upvotes: 2

Related Questions