Create an instant validation in an Apex form - oracle-apex

I would like to create validations for page items which are fields of a form. I currently have some validations set up for these page items but they trigger only after the form has been submitted. The way I would like the validations to trigger are before the form is submitted so that users get warned of errors with their current field values before submitting the form. I think what I am trying to achieve is called "server side validation".
Thank you in advance

You're looking for 'client side validation'.
There are a few good write-ups on the topic, including a plugin
http://dgielis.blogspot.com/2020/09/building-better-form-in-oracle-apex.html
And a deep dive by one of the APEX devs
https://hardlikesoftware.com/weblog/2017/05/10/apex-client-side-validation/
The main thing to remember is regardless how to supplement the UX with client side validation, server side validation is a required.
Also note, natively defined validations are also performed prior to page submission, where possible.
https://content.dsp.co.uk/apex/client-side-validations

Related

Is there a way to change the blank attribute on Django form fields to False by clicking a button?

I am building a review form that will post to a single model in my database. This form will have multiple sections, each with its own set of questions. I want the user to be able to complete a section and hit a submit button that will save the progress and redirect them to the next section. In essence I want to create an in progress status for the review with the idea that as all sections are finished the user can hit a complete button that will run my validation on the entire form. However, I do not want to allow posting information to the database that has not been cleaned.
I've been thinking through this trying to work out what I need to do and believe the best bet would be to have a complete button on the last page that changes blank to False for the fields of the form. I believe this would allow me to fill out each form and post it to the database as all fields would start as optional but then for that specific model instance the click of the button at the end would institute a change making all fields required, thereby running validators to ensure the form is complete. I believe this will also allow for saving progress and returning to it later if interrupted during completion of the form.
Can anyone provide any insight on if this is even possible? If so does anyone have examples that could guide me?
You can store the unvalidated data to the user's session. The final stage pulls all previous step data out of the session for validation. IIRC the Django form wizard does just this so you don't have to write it.
I might instead do this client-side, using one big (probably Crispy) form, and some client-side pseudo-submit buttons that just invoke Javascript to hide one section of the big form and reveal the next. The final one is a real submit, and redisplay of the whole thing if there are errors.

Eloqua Forms - Progresive Profie / Profiling

I'm quite new in Eloqua. I'm trying to generate Progressive Profiling Forms, and as I can find in the web, there are two ways: Adding Rules, or setting Stages or Linear flow. But, I am not being able to do either.
Any help?
By the way, the most I could progress, is: click on Progressive Profile button, add some fields, then copy/paste HTML+JS generated, and open the form in Chrome (the whole code seems to be complete auto-sufficent). But there are many weird behaviors...
The way progressive profiling form works is:
Form Fields where contact data is populated using Field Merges are hidden. Form fields which do not have a value (or if the field merge could not populate a value) are displayed for the submitter to provide.
This means that each time a contact provides some information, This data is captured and hidden, so that the next visit (or a visit to a different page) will display a different set of fields
Quoting one article (This is the same link you provided on an earlier question)
As the contact comes back to get more information from you,
progressive profiling allows you to ask them for more and equally
important, new, information about themselves. You get to know them
better over time all the while making it easy for them to get what
they want. Then, like any form data collected, this information can be
used to enable lead scoring, persona development and predictive
analysis modeling.
The first run will show a small set of fields (this is configured manually on the Eloqua forms)
When the same contact enters another webpage with a similar form, on the same browser as before (This is essential), the earlier fields are hidden and a new set of fields are displayed.
In other words, with each visit fields which are pre-populated with contact data are hidden from view and only the fields that do not have a value are displayed.
Note
For Progressive Profiling to work, The browser must have cookies enabled, and the form fields must have a Field Merge
Progressive Profiling does not work on a local html. It has to be on a Landing Page or a website with Eloqua tracking
The Progressive profiling behavior is different, if your page domains are different (example1.com and example2.com for instance)
Additional References
You can refer to Oracle's documentation for further details on this. For configuring Progressive Profile on Eloqua forms, you can refer the links below
Adding a Progressive Profile - This mode will just list x fields that do not have values. The x would have to be manually added into Eloqua
Configuring a progressive profile in staged mode - This will display a group of fields rather than just going one field after another
You can also refer to Oracle Communities where you will get a more concise response from Eloqua users, if not Consultants from Oracle
When searching communities, you might be some across articles about a Progressive Profiling Cloud Component, this component was discontinued in 2017

Sitecore Web Form for Marketers - create a cookie

This is a two part question.
Using Web Forms for Marketers 2.3:
Is it possible to have a cookie be created on successful submission?
Without actually exporting the ascx file, would like to keep it in Sitecore.
Second question, would it be better to have a content editor choose which item has the form or would it be better/easier to have a dropdown to pick which form is needed and then have the code determine which form to show.
Thank for any insight!!!
For the First question,
If you have Sitecore DMS, on a successful submission there is an event, and a Goal maybe you can use that, insteed of a cookie.
See https://doc.sitecore.net/sitecore%20experience%20platform/personalization/walkthrough%20personalizing%20components for using it with personalization rules the picturs are for Sitecore 8 but basically the same for Sitecore 6.5+
Programmatically you can use the Analytics API, see https://sdn.sitecore.net/upload/sitecore6/65/engagement_analytics_api_cookbook_sc65-a4.pdf for Sitecore 6. The API has changed considerably with Sitecore 7.5.
An alternative is to set the cookie on the Success page.
you can have a Success page, or a Success message in WFFM. for a message use something like this:
Thanks <script>document.cookie="formsuccess=ok";</script>

How to prefill the image field on form validation error Django?

I have a simple Django form with Image field and some other fields. Now the user has entered the form field and pressed on submit. Due to some error, the form has not validated.
As a result of the form not validated, the form image field is cleared of i.e. the user has to again enter the image field. I dont want this to happen. I want the image field to contain the same value the user had entered. Is it possible to do this ?
Note : What I have read and know, there is no way of pre-filling this image field, as it can be a big security threat. But one of my technical clients is insisting that it can be done using session variables of some sort. Is it possible ?
Validate the form on the client side using JavaScript, and prevent submission unless the form is valid. That way, you won't lose the existing content because your form won't get submitted unless it's already validated OK.
Assuming you're using jQuery, you could bind to the click event of the submit button, and use preventDefault to stop the default behaviour. Then validate the form, and submit it only if it appears to be valid.
That way you will only ever have the form submitted to Django once it has already been validated and so as long as your client-side validation is reliable, you shouldn't experience this issue.
To show the image in the view, it would need to be saved to your server, S3, or whatever else you are using for static/media files.
From JavaScript, you may be able to store the chosen file in localStorage, and set the remembered chosen path on form error. I'm not sure if the HTML5 filesystem API allows this. See http://www.html5rocks.com/en/tutorials/file/filesystem/
As Matthew Daly said, going with client-side validation is the best choice; anything else would probably be a headache.

Sitecore (Web Forms for Marketers) success page

Let's imagine I've made a simple form using the Web Forms for Marketers module 2.2 (for CMS 6.4), and have set this up to use a 'success page' (server side redirect to a specified sitecore item). This works great.
Now it turns out that the thank you page needs to show certain field variables from the form which was just submitted.
"Dear x, thank you for your interest in Y".
On the success page, it seems like there is no way to retrieve the information (server-side) I need to show this information.
What would be a good way to approach this problem?
Is there a way to hook into sitecore webforms before the page is redirected to the success page (so I can pass along an orderId, for example)?
You can create a custom action which will give you access to all the forms data. From the action you can redirect the user to the appropriate place. You can find documentation on how to create a custom action in the reference guide on page 42.
Make sure your action is always after Save To Database because otherwise the data won't be saved.