Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Customize & Extend
Answered

Select the Next button with JavaScript on a Multi Step form

Like (0) ShareShare
ReportReport
Posted on 19 Jan 2024 22:54:43 by 17

Does anyone know if we can select the Previous/Next button in a multi step form with JavaScript?

I have a form that accepts file attachments and I have a workflow for it that is triggered by button I added through metadata.  The problem is that workflow runs before the record is saved with the attachments. I'm trying to get around this by forcing the page the save somehow. 

 

I've done something similar with other buttons but can't seem to get it to work for the Next/Previous buttons.

 

Example below will successfully click the workflow button:

$("button[class='workflow-link btn-default btn']").click();

 

Categories:
  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on 23 Jan 2024 at 08:12:39
    Re: Select the Next button with JavaScript on a Multi Step form

    You can integrate cloud flows with Power Pages and this will get the response of the flow in real-time. You have to trigger it via JavaScript, but it works Sync: Trigger clouds flows from Power Pages - YouTube

    Not sure if you are passing a file via body, but I had issues before due to HTTP request being too long

  • GhostPickle Profile Picture
    17 on 22 Jan 2024 at 23:04:00
    Re: Select the Next button with JavaScript on a Multi Step form

    Thanks, Saud! I think I tried every possible way to write that incorrectly.

  • Fubar Profile Picture
    8,023 Super User 2025 Season 2 on 22 Jan 2024 at 22:04:14
    Re: Select the Next button with JavaScript on a Multi Step form

    Workflows as buttons kind of suck for this reason, as there is no save of the current data on the form prior to the workflow triggering.

    You could also consider setting the Yes/No in question inside the forms Validator (these validations get evaluated on Next) - couple of different examples on this page https://learn.microsoft.com/en-us/power-pages/configure/add-custom-javascript#additional-client-side-field-validation

  • GhostPickle Profile Picture
    17 on 22 Jan 2024 at 15:55:07
    Re: Select the Next button with JavaScript on a Multi Step form

    Hey Oliver,

    I was trying to use a real time workflow to trigger a cloud flow I built that uses the attached file. However, the record not saving before running the WF messed up that plan. Now I'm trying to create a custom button on the step that will set a yes/no field then save the record to start the flow. 

    So, my next step is finding out how to had a button that will set that field and then use the script provided by Saud to save the record. 

  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on 20 Jan 2024 at 17:51:24
    Re: Select the Next button with JavaScript on a Multi Step form

    Hi, what is your workflow doing? would you consider Cloud Flows for that? 

  • Verified answer
    Saud Ali Profile Picture
    812 Super User 2024 Season 1 on 20 Jan 2024 at 17:44:07
    Re: Select the Next button with JavaScript on a Multi Step form

    Hi @GhostPickle ,

     

    You can do the same for Next and Previous buttons available on your multi step form as you are doing above. Inspect your form to get id of button and call jQuery to perform click.

     

    To get button id, do this: 

    saudali_25_0-1705772483803.png

     

    To call click event, you can do the same.

     

    $("input#NextButton").click();
    $("input#PreviousButton").click();
    

     

    Feel free to share if you have any questions.

     

    Thanks,

    Saud

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 2

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 2

#3
surya narayanan Profile Picture

surya narayanan 35

Featured topics