Item becomes null after submitting page in Oracle APEX - oracle

I'm currently using Oracle APEX. I have this validation that executes error message whenever an item is null. And I have created a dynamic action when losing focus, it formats into a currency format.
I have this problem whenever I submit the page, my item becomes null / my validation executes.
My assumption is that validation comes first before the dynamic action.
Validation
Item is not null
Dynamic Action
Lose Focus
Action
Execute PLSQL that formats to a currency value.
Scenario:
Fills-up an item
Click submit button ahead
Expected Result:
Empty validation should not trigger when page is submitted.
Actual Result:
Empty validation is triggering when page is submitted.

Try this set you offending validation to never and make sure the dynamic action is doing what you want. Oracle in general is klugy with number formatting.

Related

How to display item value as a &Item. without refresh?

I am trying to display a value of an item like that:
Some text &P5_ITEM.
It's works only when I refresh a page, without refreshing I can only see a previous value of an item.
I tried to submit a item value with dummy pl/sql
null;
Items to Submit &P5_ITEM.
but it didn't work
It's work only with a javacript
Location.reload()
But it is not a solution becouse it invokes reload after reload since dynamic action starts when page load.
I figure out how to fix that, instead of calculating value of an item in dynamic action fired when page load I passed value of the item in link attributies and it's working properly.

Validate Item Before Submit APEX

I am trying to validate a year field (item) to ensure that the field is 4 digits and fits between 1960 and 2059. I want to do this before I submit the page, preferably after leaving the field through tab or click out. Any thoughts?
Using the settings for numeric items should do this for you (from 5.1). If the submit page is pressed, APEX will do it's best to do any client side validation before submitting.
You can create a dynamic action to test the value yourself on change, but you should retain any server side validation.
There are also some plug-ins that can help, such as Live Validation.

How to submit the value in an inputtext field by setting autoSubmit to false

I have an ADF form based on a VO and I need to check whether a particular field is null or not on click of a Submit button. For this, i set autoSubmit to true and get the value entered to a variable in my bean.On click of Submit button , i check if the variable is null or not and display error faces message if the variable is null. But how do i get the value entered in the form to a variable in the bean with autoSubmit set to false?
Why do you have it turned on in the first place? And why do you want to turn it off? Are you clear on it's functioning and why to use it?
Autosubmit is used to support Partial-Page Refresh.
If you don't need PPR, Just turn it off. The value will still be available once the submit button is pressed. Read about it here.
An input component that has its autosubmit property set to true also
performs a partial submit of the form. However, this time it doesn't
submit the entire form but only the component that triggers the submit
plus components referenced it in their PartialTriggers property.
Autosubmit is not required to access values entered into input components on the screen. Autosubmit submits only the field and also bypasses certain phases of the page processing lifecycle.
if you turn autosubmit off, the entire page - all the fields - is submitted and goes through the complete page processing lifecycle, so you have access to all input fields.
Docs here.

APEX: Call JavaScript function after validation but before processing

I have been tasked with re-creating an old PL/SQL Web Toolkit front end in Application Express (Apex).
I would like to display a popup after the page is submitted and after computations and validations.
The page can be submitted by clicking a button OR by hitting enter.
I have googled and got a modal popup working (called by javascript) but I can't seem to call it at the right point. I can call it on submit (before the validations etc.) but not after the validations.
I have tried creating a branch to URL at the correct processing point and then have the URL set to:
javascript:openForm();
But then I get a page will not display error.
Can anyone out there explain how I could do this?
Apex Version: 4.0.2
Oracle 10g
I suppose what you want to do is to perform the validations, have values submitted to session state, but not execute further processes.
However, when you submit the page it is sent to the server; and everything you see in the page processing region will sequentially fire. There is no way to halfway through the processes call a javascript function, since basically you are not on the clientside anymore.
What you can do is to create a branch after your validations to the same page. Redirect to it but provide a REQUEST value, for example OPENFORM.
Create a dynamic action, firing on page load, with a true action that executes javascript and opens up your modal page. Then set the condition on your dynamic action to Request = Expression 1, providing the request value to Expression 1 (OPENFORM).
(Note that this is the Conditions region, and not the 'Condition' field of the 'When' region)
This should cause the page to be submitted, validated, then re-loaded but with a request value, and the dynamic action firing, opening your modal page.
Just a point of interest:
If you have actual processes on this page though, then be careful with the Enter key. Buttons by default submit to session with the request value set to their name, and thus making it possible to conditionally execute processes or branches. The enter key does not submit with a request value set i believe. So if your branch is conditional, the enter key might simply skip over it.

Selected Dropdown value changes when validation fails-ASP.NET MVC

I am using MVC 3 with ASP.NET. I have a dropdown box and getting it populated from database. I am using validation on the View. If it fails the validation, I am displaying the same view with errors being caught in ViewDate.ModelState.AddModelError.
I am checking for the ViewData.Modelstate.IsValid property if true then execute the code else display the errors in the view.
It is diplaying the errors in the page, but the selected value in the drop down is getting reset when validation fails.
How do I make sure the seleceted drop down does not change when validation fails?
In the action that handles the form submission and validation, make sure you set the properties on your model object from the form before rendering the form view.
For example, in this question you can see how the Dinner object parameter in the Create action is reused when the View() is returned.
Set a breakpoint in the action handling the submission and check the property for the list of values. If it's null or empty reload it.
If your dropdownlist is being populated via javascript then it is possible that the property holding the list of values is empty on submission. This is common when using cascading dropdownlists such is the case with loading Province / State lists based off country. All cascading lists loaded after the model has been passed to the view must be reloaded using the selected value of for each dropdownlist in the controller action that is handling the submission.

Resources