How do people handle form confirmation/checking?

I’d like to know how people are handling form confirmation or checking.

say for example I have a simple form to do something simple like create a mailing list

the user enters the data and clicks submit, the page then checks the information submitted and generate names and some other attributes and would like the user to double check this data before a final submission to a script.


please verify the data before submitting, if it is incorrect please update the form with the correct info
name: EDBList-LOC1
Location: Loc1
description: Mailing list for EDB - owner xyz
owner: xyz
function: Eng01
Job No: 0001/Code:abc

I’m guessing most people are using modals to do this, or does anyone
else have a nice solution? A stepper would be perfect but we use schema forms and dont want to change that.

Forms have a built in validation structure

I use it like this

    if ($formcontent.FIELD_ID -eq $null -or -not($formcontent.FIELD_ID -match "^[a-zA-Z]+$")){
        New-UDFormValidationResult -ValidationError "ERROR MESSAGE UNDER THE SUBMIT BUTTON HERE"
    elseif ($formcontent.FIELD_ID -eq $null -or -not($formcontent.FIELD_ID-match "^[a-zA-Z]+$")){
        New-UDFormValidationResult -ValidationError "ERROR MESSAGE UNDER THE SUBMIT BUTTON HERE"
else {
        New-UDFormValidationResult -Valid   

I believe you could put other script info in those blocks. Like username generation or whatever.

1 Like

thanks, yes I was just curious at ways that people approached this.

One thing I have done is have the people using the form click an extra Verify button after certain steps and run the name/attribute generation then, and have it show the generated data in a separate column with a checkbox they need to click to verify again that all the information is correct.

1 Like

Here’s how I do it:

New-UDPage -Name 'Form' -Url '/form' -Content {
    New-UDForm -Content {
        # Form stuff
    } -SubmitText 'Preview' -ButtonVariant 'contained' -OnSubmit {

        # On click of Preview button, add content to Preview element 
        set-UDElement -id 'preview' -content {
            New-UDPaper -content {
                "This is a preview"
            } -Elevation 2

            # Create a button to confirm preview and send data to specified email.
            New-UDButton -Text 'Finalize' -OnClick {
                # Finalize button has been pressed
                # Submit form content to logic/script/whatever
                } -Color primary -ShowLoading

    # On page load, set preview element to empty 
    New-UDElement -Id 'preview' -Tag 'div'

So I’ve got the form at the top, then when submitting the form it populates the empty “Preview” element. Inside that element is another button that actually finalizes the form and submits the collected information into whatever logic is needed.


nice and simple!

What do you do if the data in the paper is not correct and needs to be fixed? Do they reload the form and start over?

Since the original form is still visible, it can be changed and the user can click ‘Preview’ to update the paper.

If you don’t want the form still visible, I recommend looking at using a Stepper instead. That can do all the same things, however it will advance to different stages and will include a back button.