Template source: vendor-update.html

<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Update Vendor detail..</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        body {
            font-family: Arial, Helvetica, sans-serif;
            font-size: .8rem;
        }
        .error {
            color: #dc3545;
        }
        .success {
            color: #28a745;
        }
        .booking-wrap {
            max-width: 400px;
            border: 1px solid #DDD;
            box-shadow: 2px 2px 2px #CCC;
            padding: 20px;
            padding-bottom: 8px;
            border-radius: 4px;
            margin: auto;
            left: 0;
            right: 0;
            bottom: auto;
            top: auto;
            /*max-height: 500px;*/
            position: absolute;
        }
        .rows {
            margin-bottom: 15px;
            text-align: center;
        }
        .rows label { text-align: left}
        .rows label strong {
            margin-bottom: 5px;
            display: block;
        }
        .rows input {
            width: 94%;
            border: none;
            min-height: 25px;
            border-radius: 4px;
            border: 1px solid #DDD;
            padding: 1% 3%;
        }
        button, .btn {
            border-radius: 4px;
            line-height: 40px;
            padding: 0 15px;
            width: 100%;
            /* max-width: 360px; */
            margin: 0 auto;
            cursor: pointer;
            background: #40a3d3;
            color: #FFF;
            font-size: 1rem;
        }

        button:hover, .btn:hover {
            opacity: .9;
        }
        button[type="submit"]:disabled {
            background-color: #DDD;
            cursor: default;
        }
        h2 {
            text-align: center;
            margin-bottom: 15px;
            border-bottom: 1px solid #DDD;
            padding-bottom: 10px;
        }

        .booking-wrap-2 {
            max-width: 200px;
            border: 1px solid #DDD;
            box-shadow: 2px 2px 2px #CCC;
            padding: 20px;
            padding-bottom: 8px;
            border-radius: 4px;
            margin: auto;
            left: 0;
            right: 0;
            bottom: auto;
            top: auto;
        }

    </style>
</head>
<body>
    
    <div class="booking-wrap-2">
        <img height="50" src="{% static 'images/ht_media_logo.png' %}">
    </div>
    <div class="booking-wrap">
        <h2>Vendor Detail</h2>
        
        {% if is_error %}
        <div class="rows error">
               {{message}}
        </div>
        {% endif %}

        
        
        {% if lead  %}


        
        <form method="post" onsubmit="return submitform()"">
            {% csrf_token %}
         
         {% if form.errors %}
        {% for field in form %}
            {% for error in field.errors %}
               <div class="rows error">
                   <strong>{{ error|escape }}</strong>
               </div>
            {% endfor %}
       {% endfor %}
        {% for error in form.non_field_errors %}
            <div class="rows error">
               <strong>{{ error|escape }}</strong>
            </div>
        {% endfor %}
      {% endif %}
      {% if success %}
           <div class="rows success">
               <strong>Thank you for updating the vendor information</strong>
            </div>
      {% endif %}
        <div class="rows">
            <label>
                <strong>Form No: </strong>
                <input type="text" placeholder="{{lead.booking_form_no}}" disabled/>
            </label>
        </div>
        <div class="rows">
            <label>
                <strong>Reader Name: </strong>
                <input type="text" placeholder="{{lead.customer_name}}" disabled/>
            </label>
        </div>
        <div class="rows">
            <label>
                <strong>Mobile No: </strong>
                <input type="text" placeholder="******{{lead.mobile|slice:'6:'}}" disabled />
            </label>
        </div>
        <div class="rows">
            <label>
                <strong>Vendor Name: </strong>
                {{form.vendor_name}}
                <!-- <input type="text" placeholder="Vender Name" name="vendor_name" /> -->
            </label>
        </div>
        <div class="rows">
            <label>
                <strong>Vendor Mobile No: </strong>
                {{form.vendor_mobile}}
                <!-- <input type="text" placeholder="Vender Mobile No" name="vendor_mobile" />
                 -->
            </label>
        </div>
        <div class="rows">
            <label>
                <strong>Centre Name: </strong>
                {{form.center_name}}
                <!-- <input type="text" placeholder="Centre Name" name="center_name" /> -->
            </label>
        </div>
        <div class="rows error" id="mobile_err" style="display: none;">
            Please enter 10 digit mobile
        </div>

        <div class="rows">
            <button type="submit" class="btn"  {% if form.is_readonly %}DISABLED{% endif%}>Submit</button>
        </div>

        </form>
      {% elif is_error %}
            <div class="rows error">
               {{message}}
             </div>
      {% endif %}  
    </div>

<script type="text/javascript">
    function submitform()
    {
          var mobile = document.getElementById('{{form.vendor_mobile.auto_id}}');
          var mobileValue = mobile.value.trim();
          if(mobileValue.length != 0)
          {
           if(mobileValue.length != 10)
           {
              mobile.focus();
              document.getElementById('mobile_err').style.display = "block";  
              return false
          }

           if(!/^\d*$/.test(mobile.value))
           {
               mobile.focus();
              document.getElementById('mobile_err').style.display = "block";
              return false;
           }
         }

          return true;
         //document.forms["sp2"].submit();
    }
</script>

</body>
</html>