Can the form show column numbering?

Home Forums Classic DFFS Can the form show column numbering?

Viewing 8 reply threads
  • Author
    Posts
    • #7961
      Kristoffer Bertsch
      Participant

        Hi, I have a few lists used for testing. We did some updating to our tests where we have now numbered each question. I would rather not update each column with a number in front of the question but instead have a number show on the form for each column/question. Is this possible?

        I appreciate your help!
        -Kris

      • #7962
        JGMcLoughlin
        Participant

          Kris,

          Could you use the ID field? This would give you a number unique to the question. A danger would be that the questions would have to be entered in the correct order.

          OR
          Introduce another column for the Question Number, and show that ahead of the question on the form.

          John

        • #7963
          Kristoffer Bertsch
          Participant

            Hi John,

            I don’t like the 2nd option only because it kind of makes the form look sloppy. Also, I would need to incorporate some type of CSS to make the new number columns widths fit to the object in the column, which I am not good at.

            The 1st option, are you referring to the SharePoint unique ID? Or the ID field in the backend for each column?

            -Kris

          • #7964
            JGMcLoughlin
            Participant

              Kris,

              I was thinking of the unique ID that each record in a list has. It is usually hidden, but can be made available. The only time you can’t use it is when creating a record as the ID is only assigned once the record is saved. This may cause problems as you have no control over the number.

              You could do something with the first option, by creating a third, calculated field which creates a composite of the question number and the question, e.g.

              
              
              Q No    Question                         Composite
              1.      What colour is the sky?          1. What colour is the sky?

              Just a thought.

              John

              • This reply was modified 9 years, 6 months ago by JGMcLoughlin.
            • #7966
              Kristoffer Bertsch
              Participant

                Hey John,

                If I am thinking of the same Unique ID you are, that would keep counting and wouldn’t align once a test has been completed. Are you referring to an ID in the DFFS backend that can be made visible?

                -Kris

              • #7967
                JGMcLoughlin
                Participant

                  Kris,

                  You are correct in thinking of the ID in the SharePoint list. Would make life difficult for you. How about my other idea?

                  John

                • #7968
                  Kristoffer Bertsch
                  Participant

                    I like the separate column idea, could you help with a custome CSS? For example if using a number field have it fit to the width of the text in the column so that it will align next to the question.

                  • #7979
                    Alexander Bautz
                    Keymaster

                      Hi,
                      Sorry for the delay. Here is a pure CSS example – found in this page: https://css-tricks.com/numbering-in-style/

                      Add this to the Custom CSS in the backend:

                      .ms-formtable{
                      	counter-reset: spjs-css-counter;
                      }
                      .ms-formtable h3:before {
                      	content: counter(spjs-css-counter);
                      	counter-increment: spjs-css-counter;
                      	font: bold 25px/1 Sans-Serif;
                      }

                      This will number the columns from the top, so if you have some hidden columns you could use something like this in the Custom JS section to add the number to only the visible columns in JavaScript:

                      function customFieldNumber(){
                      	spjs.$(".customFieldNumber").remove();
                      	setTimeout(function(){
                      		spjs.$("td.ms-formlabel:visible").each(function(i,td){
                      			spjs.$(td).find("h3").prepend("<span class='customFieldNumber'>"+(i+1)+"</span>");
                      		});
                      	},1);
                      }
                      
                      // On tab change
                      spjs.$("li.tabBase").click(function(){
                      	customFieldNumber();
                      });
                      
                      // On page load
                      customFieldNumber();

                      Style the new number in the Custom CSS like this:

                      .customFieldNumber{
                      	font-size:25px;
                      	color:green;
                      }

                      Alexander

                    • #8017
                      Kristoffer Bertsch
                      Participant

                        Great! Thank you and thanks for sharing the link, it will come in very usefull!

                    Viewing 8 reply threads
                    • You must be logged in to reply to this topic.