HTML / Programming question for the propellerheads out there..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 2MuchMark
    Mark of 2Much.net
    • Aug 2004
    • 50973

    #1

    HTML / Programming question for the propellerheads out there..

    Tits!

    I have a web page with a bunch of fields on it. The data in the fields are populated from a DB. The user can edit all of the fields except for one.

    That field looks like this:

    <input id="pC" name="pC" type="text"placeholder="Blah" class="form-control valid" maxlength="10" value="" disabled="disabled">

    The problem is that this LOOKS like an editable field so users try to change the value. What I want to do is just display the data it contains in a plain-ol' format.

    Any suggestions?
  • myleene
    Confirmed User
    • Oct 2013
    • 906

    #2
    Could you use a span?

    Demo: https://jsfiddle.net/q390kdLp/

    Comment

    • EddyTheDog
      Just Doing My Own Thing
      • Jan 2011
      • 25433

      #3
      Code:
      <input id="pC" name="pC" type="text" STYLE="background-color: #A9A9A93"  placeholder="Blah" class="form-control valid" maxlength="10" value="" disabled="disabled">
      That should just grey it out - I didn't test it, but I think that will work...

      That would be the standard way of indicating a text field is not editable - You can see 'blablah'.....

      https://jsfiddle.net/bwh0cnme/

      I always forget about jsfiddle...

      Comment

      • RazorSharpe
        Confirmed User
        • Aug 2001
        • 2238

        #4
        Change the css on the disabled selector. For example:

        .form-control:disabled, .form-control[readonly]

        You'll likely have a background colour attached to it - remove it.
        Add in:
        border: none;
        Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

        Comment

        • zerovic
          Confirmed User
          • Apr 2010
          • 1116

          #5
          Hi,

          disabled fields should be greyed out automatically by most modern browsers, however you can simply add a css rule for the disabled input fields like

          input:disabled {
          background:#f0f0f0;
          }

          cheers,
          z
          php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com

          Comment

          • Coyote
            Drinker of Scotch
            • May 2003
            • 242

            #6
            Originally posted by 2MuchMark
            Tits!

            ...The user can edit all of the fields except for one.

            ...What I want to do is just display the data it contains in a plain-ol' format.

            Any suggestions?
            If all you want is to display the data, get rid of the input field since the data does not change. Instead, style a text element (P, span, div, etc.) and place it in the proper position on your form.
            Ethernet Servers

            Quote:
            CS: Linux can pretty much run on a potato. Which is a GOOD thing.

            Comment

            • 2MuchMark
              Mark of 2Much.net
              • Aug 2004
              • 50973

              #7
              Thank you! will try all ideas today.

              Comment

              • machinegunkelly
                Confirmed User
                • Jun 2003
                • 3304

                #8
                Guys, RTFM.

                use .form-control-plaintext

                https://getbootstrap.com/docs/4.4/co...nly-plain-text
                dead.

                Comment

                • zerovic
                  Confirmed User
                  • Apr 2010
                  • 1116

                  #9
                  Originally posted by machinegunkelly
                  Guys, RTFM.

                  use .form-control-plaintext

                  https://getbootstrap.com/docs/4.4/co...nly-plain-text
                  I'm not a fan of frameworks... especially not bootstrap the replies above are all general solutions and all of them will work.
                  php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com

                  Comment

                  • machinegunkelly
                    Confirmed User
                    • Jun 2003
                    • 3304

                    #10
                    Originally posted by zerovic
                    I'm not a fan of frameworks... especially not bootstrap the replies above are all general solutions and all of them will work.

                    He's already got bootstrap in his stack...
                    dead.

                    Comment

                    • zerovic
                      Confirmed User
                      • Apr 2010
                      • 1116

                      #11
                      Originally posted by machinegunkelly
                      He's already got bootstrap in his stack...
                      well then, fair enough
                      php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com

                      Comment

                      • machinegunkelly
                        Confirmed User
                        • Jun 2003
                        • 3304

                        #12
                        Originally posted by zerovic
                        well then, fair enough
                        Yea, not really the biggest bootstrap fan myself, but if it's in his stack, which I suspect it is by the class names used on his input, it's best to not re-invent the wheel.
                        dead.

                        Comment

                        • zeubx
                          Confirmed User
                          • Apr 2007
                          • 50

                          #13
                          Bootstrap and javascript are not a solution. I can post a lot query using curl in command line.
                          Fix your pĥp script, this is the right way.

                          Comment

                          • blackmonsters
                            Making PHP work
                            • Nov 2002
                            • 20961

                            #14
                            <input id="pC" name="pC" type="hidden" value="Blah" >Blah


                            Free Open Source Live Aggregated Cams Script (FOSLACS)

                            Comment

                            • 2MuchMark
                              Mark of 2Much.net
                              • Aug 2004
                              • 50973

                              #15
                              Thanks for the suggestions, but none of them did what I was looking for.

                              Here's a better description of the problem. I have form that people can access and modify as they need to. One of the form elements is a commission field, that they cannot edit.

                              It looks like this



                              The code that displays it looks like this

                              <input id="Commission" name="Commission" type="text"
                              placeholder="Commission" class="form-control valid"
                              maxlength="10" value="" disabled="disabled">

                              Input for this field is already disabled and that's fine, it works, but it still LOOKS like a field that can be edited.

                              All I really want it to say is "Commission: 50%"

                              How do I simply show the value of "Commission" without making it an input field?

                              Comment

                              • 2MuchMark
                                Mark of 2Much.net
                                • Aug 2004
                                • 50973

                                #16
                                Nothin' ? Nada, zip ?

                                Comment

                                • Coyote
                                  Drinker of Scotch
                                  • May 2003
                                  • 242

                                  #17
                                  Originally posted by 2MuchMark
                                  ...
                                  All I really want it to say is "Commission: 50%"
                                  How do I simply show the value of "Commission" without making it an input field?
                                  See my previous comment.
                                  Ethernet Servers

                                  Quote:
                                  CS: Linux can pretty much run on a potato. Which is a GOOD thing.

                                  Comment

                                  • zerovic
                                    Confirmed User
                                    • Apr 2010
                                    • 1116

                                    #18
                                    Contacted you on skype.
                                    php, html, jquery, javascript, wordpress - contact me at contact at zerovic.com

                                    Comment

                                    • RyuLion
                                      • Mar 2003
                                      • 32369

                                      #19
                                      Great ideas already above!!

                                      Adult Biz Consultant A tech head since 1995
                                      Affiliate Support: Chaturbate | CCBill Live

                                      Comment

                                      Working...