Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

Numbering Gravity Forms List Field Rows

Last updated August 22, 2019 | Written by David Smith 27 Comments

View DemoDownload Code
/**
* Numbering List Field Rows
* http://demos.gravitywiz.com/numbering-gravity-forms-list-field-rows/
*/
body .gw-number-rows table.gfield_list {
counter-reset: gflistrowcounter;
margin-left: -24px;
}
.gw-number-rows .gfield_list thead tr:before {
content:'';
}
.gw-number-rows .gfield_list tbody tr:before {
content: counter(gflistrowcounter);
counter-increment: gflistrowcounter;
}
.gw-number-rows .gfield_list thead tr:before, .gw-number-rows .gfield_list tbody tr:before {
display: table-cell;
width: 18px;
text-align: right;
padding-right: 6px;
}
view raw gw-gravity-forms-numbering-list-field-rows.css hosted with ❤ by GitHub

Here’s a quick bit of CSS that will automatically number your Gravity Forms List field rows. It does this using CSS psuedo elements within each row to add a “number” column.

Getting Started

To install this snippet, copy and paste the CSS code to your theme’s style.css file. Then on any List field for which you would like to number the rows, just add the gw-number-rows class to the field’s “CSS Class Name” setting.

gw-gravity-forms-number-list-field-rows-css-class-name-setting

Notes

This will work in all modern browsers and IE9+. Depending on your site’s styles, you may need to adjust the margin and width set in the CSS snippet. Experiment!

Was this helpful?

If this helped you, let us know in comments! If you use this in the wild, share a link so we can see what you’ve done with it.

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 32+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: Snippets

Comments

  1. Moorey says

    July 12, 2018 at 3:30 am

    Would this work with PDF output?

    Reply
    • David Smith says

      July 13, 2018 at 11:32 pm

      Unlikely. You would probably need to include the styles in the PDF generator (assuming it provides a setting for custom CSS).

  2. alper karaman says

    November 13, 2017 at 10:43 am

    Hello David, is there any way numbering the entries in gravity view like 1. David (first approved entry) 2. Alper (second) 3. …. (third) 4. ….

    Reply
    • David Smith says

      November 13, 2017 at 11:51 am

      Hi Alper, this solution does not apply to Gravity View. I’d ping their support to see if there’s an existing solution.

  3. alper says

    November 9, 2017 at 4:09 am

    hello david,

    is there any way to add numbering the table rows field 1 to end 1. asd 2. dfd 3. fdf 4. fgdf …

    Reply
    • David Smith says

      November 13, 2017 at 8:53 am

      I’m not sure I understand?

  4. Andy Daum says

    April 7, 2016 at 3:07 am

    Dear David,

    Thank you so much for all the material you create.

    I’m having a small issue with this snippet. Namely, I can’t get the numbers to increase sequentially. It’s just 1,1,1,1,1,1.

    I thought might be to do with the fact I have this plugin https://wordpress.org/plugins/gravity-forms-list-field-select-drop-down/ installed and was using in the relevant list field. However, I removed the dropdown, deactivated the plugin, and got the same result.

    I’ve put images of all this in this public Doc: https://docs.google.com/document/d/10f25t9NHRMq5pgawN_u9iOfX0hCkh0UXKOnefDCVCns/pub

    I hope I’ve not made any silly errors here, and apologies if so. I would really appreciate your advice!

    Thank you very much. Best, A.

    Reply
    • David Smith says

      April 7, 2016 at 10:20 am

      Do you have a URL where I could view the form?

  5. Daniel Bishop says

    October 9, 2015 at 7:14 pm

    Thanks so much for this snippet! It adds a nice bit of polish to a form I’m building.

    Reply
    • David Smith says

      October 10, 2015 at 8:44 am

      Our pleasure, Daniel. Glad you enjoyed it.

  6. flo says

    April 20, 2015 at 10:08 am

    Hi, can I display the total number of rows with a merge tag in another field?

    Reply
    • David Smith says

      April 20, 2015 at 7:10 pm

      Hey Flo, I don’t have a solution for this right now. :/

  7. Lars says

    April 7, 2015 at 4:23 pm

    Hi David,

    Would it be possible to have a list field with two columns and then populate the first column with numbers same way as the above snippet does, but inside the input field instead?

    I’m new to GF and what a great ressource this site is!

    Reply
    • David Smith says

      April 7, 2015 at 7:41 pm

      Hi Lars, glad you’re finding the site useful. Unfortunately, I don’t have a ready solution for populating the number into one of the columns of the List field.

    • Lars says

      April 8, 2015 at 2:48 am

      Hi David,

      Thanks for the prompt response. I actually thought that it was a pretty simple thing to do using “dynamic population” one way or the other, and that the solution above was of the more advanced type.

      As an alternative, using the above solution, are the numbers for each row then included in any submission of the form?

    • David Smith says

      April 8, 2015 at 7:25 am

      Hi Lars, it is possible to dynamically populate the List field inputs. If you ping Gravity Forms Support they’ll be able to provide instructions on how you might do that.

      The issue, I suspect, is that when you dynamically populate a List field, it adds the rows automatically. If you want the number to be dynamically generated when a new list field is added, dynamic population probably won’t work.

    • Lars says

      April 10, 2015 at 11:34 am

      Right ok, well I managed to get a slution working with a little help from a developer and jQuery.

      It’s perhaps not perfect, but gets the job done.

      http://wpquestions.com/question/showChrono/id/10751

      Thanks for the help.

    • David Smith says

      April 11, 2015 at 11:33 am

      My pleasure, Lars, and thank you for sharing back! :)

  8. Adlan Khalidi says

    March 10, 2015 at 11:34 pm

    Hi. I’m doing a list of item using Gravity Form.

    In the end of the list or after the list, I want to display the number of rows that user has created.

    E.g. – item A – item B – item C – –

    (the last 2 has no item, so don’t need to calculate)

    Total number :[ 3 ] <- a text field with specific class but user cannot change/disabled)

    Do you know how I can achieve this?

    Thanks

    Reply
    • David Smith says

      March 11, 2015 at 11:17 pm

      Hi Adlan, do you have a visual of what you’re trying to achieve?

  9. Catharine says

    February 26, 2015 at 11:01 am

    Thanks for the link David! Do you still do commissions for features? If so, I was wondering how much you would quote for the list field conditional logic thing.

    Regards, Catharine

    Reply
    • David Smith says

      March 11, 2015 at 11:14 pm

      Hi Catherine, I sent you an email on Feb 26. Let me know if you did not receive it.

    • Catharine says

      March 12, 2015 at 6:05 am

      Hi David,

      I sent you a reply to your email on the 26 Feb, at 16:37 – just assumed you were catching up on a backlog or something! Let me know if you can’t find it and I’ll resend it.

      Thanks, Catharine

    • David Smith says

      March 12, 2015 at 9:32 am

      Hi Catharine, yeah, not seeing your reply. I just replied again in the same thread. If you’d like to reply again and confirm here, I’ll make sure I got it.

    • Catharine says

      March 12, 2015 at 10:18 am

      Hi David, I just sent you the email again (to your david@gravitywiz.com account).

      Thanks, Catharine

  10. Catharine says

    February 25, 2015 at 12:35 pm

    Hi David,

    Cool snippet! As an aside though, how did you configure that list field so that only the first two columns were required? And also, I understand that at present, you can’t use the inputs within a list field in conditional logic for other fields. Do you have or are you planning to bring out a perk to get around this?

    Thanks, Catharine

    Reply
    • David Smith says

      February 25, 2015 at 10:39 pm

      Hi Catharine, here is an article which provides a method for requiring all or specific columns of a List field:

      https://gravitywiz.com/require-all-columns-of-list-field/

      I do not currently have plans for List-field-based conditional logic.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • How To (64)
  • News (21)
  • Plugins (14)
  • Releases (7)
  • Resource (3)
  • Snippets (58)
  • Tutorials (57)
  • Updates (104)

Recent Posts

  • How to Send a Follow-Up and Pre-Fill Information
  • How to Update Posts with Gravity Forms
  • Gravity Wiz Weekly #104
  • The Complete Guide to Using Gravity Forms With Zapier
  • Gravity Wiz Weekly #103

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2021 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account