Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8615003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:15:50+00:00 2026-06-12T05:15:50+00:00

I’m using the http://www.advancedcustomfields.com plugin to create custom fields in WordPress. I’m specifically using

  • 0

I’m using the http://www.advancedcustomfields.com plugin to create custom fields in WordPress. I’m specifically using the repeater field functionality.

On a page I have a repeater that has an unlimited amount of rows. The usual way of echoing out all the data is the following:

<?php $counter = 1; if(get_field('step_by_step_training')): ?>
<?php while(the_repeater_field('step_by_step_training')): ?>
    <p class="training-<?php echo $counter; ?>"><?php the_sub_field('introduction'); ?></p>
<?php $counter++; endwhile; ?> 
<?php endif; ?> 

Is it possible to show one row of data at a time with a next button that when pressed will show the next row of data? I only want one row of data showing at a time so if row 1 is originally showing, when next is clicked it hides row 1 and shows row 2. Essentially creating a step by step process.

Eventually I’d like to include a form so the user can submit data.


UPDATE:

<form class="form" method="POST" action="<?php the_permalink(); ?>">
<?php $counter = 1; if(get_field('step_by_step_training')): ?>
<?php while(the_repeater_field('step_by_step_training')): ?>    
    <div class="form-row">
        <p class="training"><?php echo the_sub_field('introduction'); ?></p>
        <button class="next">Next Form Element</button>
    </div>
<?php $counter++; endwhile; ?> 
<?php endif; ?>     
</form>

<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {    

    // hide all form-rows, but not the first one
    $('.form-row').not(':first').hide();

    $('button.next').click(function(e) {
        // prevent the next buttons from submitting the form
        e.preventDefault();
        // hide this form-row, and show the next one
        $(this).parent('div.form-row').hide().next('div.form-row').show();
    });    

});
});
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:15:51+00:00Added an answer on June 12, 2026 at 5:15 am

    You could do something simple like this using jQuery (I think this is what you wanted?):

    $(document).ready(function() {  
      // prepend a 'previous' button to all form-rows except the first
      $('<button>').addClass('previous').text('Previous').prependTo($('.form-row').not(':first'));
    
      // hide all form-rows, but not the first one
      $('.form-row').not(':first').hide();
    
      // add the submit button to the last form-row
      $('<input>').prop('type', 'submit').val('Submit Form').appendTo($('.form-row:last'));
    
    
      // handle the previous button, we need to use 'on' here as the
      // previous buttons don't exist in the dom at page load
      $('.form-row').on('click', 'button.previous', function(e) {
        e.preventDefault();
        $(this).parent('div.form-row').hide().prev('div.form-row').show();
      });
    
    $('button.next').click(function(e) {
        // prevent the next buttons from submitting the form
        e.preventDefault();
        // hide this form-row, and show the next one
        $(this).parent('div.form-row').hide().next('div.form-row').show();
    }); 
    

    });

    some example markup:

    <form action="index.php" method="post">
    
        <div class="form-row">
            <label for="forename">Forename</label>
            <input type="text" name="forename" />
            <button class="next">Next Form Element</button>
        </div>
    
        <div class="form-row">
            <label for="forename">Surname</label>
            <input type="text" name="surname" />
            <div style="clear: both;"></div>
            <label for="another">Another</label>
            <input type="text" name="another" />
            <button class="next">Next Form Element</button>
        </div>
    
        <div class="form-row">
            <label for="last">Last Form Element</label>
            <input type="text" name="last" />
        </div>
    
    </form>
    

    You can add as many form elements to each form-row as you want, here’s a fiddle to play with

    edit

    Things to note here are that the previous buttons are injected to the DOM dynamically, and so is the forms submit button (notice how I’ve removed it from the last form-row in the markup)

    Here’s an updated fiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
Specifically, suppose I start with the string string =hello \'i am \' me And
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.