Skip to main content

Notifications

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

(0) ShareShare
ReportReport
Posted on 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,315 Most Valuable Professional on at
    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 at
    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
    7,960 Super User 2025 Season 1 on at
    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 at
    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,315 Most Valuable Professional on at
    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 at
    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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics