title: validate html form fields when print button is clicked in context menu
body: <p>i have a html form in my desktop application using phpdesktop chrome browser. i have a problem validating form fields since this form has no submit button at all because i intended to use this form for printing only so no need to submit any data online or submit button.
  i want javascript or php to check this form when user trying to print this form from context menu, simple is that!
  i only want javascript or php to make sure no field remains empty before print and all fields must filled with data.
  any help will be highly appreciated. thanks</p>
  
  <blockquote>
    <p>form.html</p>
  </blockquote>
  
  <pre><code>&lt;form&gt;
                  &lt;div class="field1"&gt;
                      &lt;input class="varify-field" id="varify-field" type="text" name="fname" maxlength="80" size="14" onkeyup="updateVerifyname();"&gt;&lt;div class="varify-name"&gt;&lt;/div&gt;
                      &lt;input class="walad-field" id="walad-field" type="text" name="fname" maxlength="40" size="14" onKeyup="updateWaladname();"&gt;&lt;div class="walad-name"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- field1 closed here --&gt;
                  &lt;div class="field2"&gt;
                      &lt;input class="sakan-field" type="text" name="fname" maxlength="40" size="11"&gt;&lt;div class="sakan-name"&gt;&lt;/div&gt;
                      &lt;input class="tehsil-field" type="text" name="fname" maxlength="40" size="7"&gt;&lt;div class="tehsil-name"&gt;&lt;/div&gt;
                      &lt;input class="zila-field" type="text" name="fname" maxlength="40" size="7" placeholder=""&gt;&lt;div class="zila-name"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- field2 closed here --&gt;
                  &lt;div class="field3"&gt;
                      &lt;input class="barmisal-field" type="text" name="fname" maxlength="40" size="11"&gt;&lt;div class="barmisal-name"&gt;&lt;/div&gt;
                      &lt;input class="darja-field" type="text" name="fname" maxlength="40" size="3"&gt;&lt;div class="darja-name"&gt;&lt;/div&gt;
                      &lt;div class="hai"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- field3 closed here --&gt;
                  &lt;div class="field4"&gt;
                      &lt;h4 class="last-line"&gt;&lt;/h4&gt;
                  &lt;/div&gt;&lt;!-- field4 closed here --&gt;
                  &lt;img  class="darkhwast-dahinda-img" height="33" width="275" src="../images/darkhwast-dahinda-img.png"&gt;
                  &lt;div class="name-wrap"&gt;
                      &lt;input class="name-field" id="name-field" type="text" name="fname" maxlength="40" size="14"&gt;&lt;div class="name"&gt;&lt;/div&gt;&lt;div class="name-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- name-wrap closed here --&gt;
                  &lt;div class="disc-maj-wrap"&gt;
                      &lt;div class="disc-maj-name"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- disc-maj-wrap closed here --&gt;
                  &lt;div class="father-wrap"&gt;
                      &lt;input class="father-field" id="father-field" type="text" name="fname" maxlength="40" size="14"&gt;&lt;div class="father-name"&gt;&lt;/div&gt;&lt;div class="father-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- father-wrap closed here --&gt;
                  &lt;div class="address-wrap"&gt;
                      &lt;input class="address-field" type="text" name="fname" maxlength="100" size="45"&gt;&lt;div class="address-name"&gt;&lt;/div&gt;&lt;div class="address-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- address-wrap closed here --&gt;
                  &lt;div class="marital-status-wrap"&gt;
                      &lt;input class="marital-status-field" type="text" name="fname" maxlength="40" size="9"&gt;&lt;div class="marital-status-name"&gt;&lt;/div&gt;&lt;div class="marital-status-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;/br&gt;&lt;!-- marital-status-wrap closed here --&gt;
                  &lt;div class="wife-husband-wrap"&gt;
                      &lt;input class="wife-husband-field" type="text" name="fname" maxlength="40" size="8"&gt;&lt;div class="wife-husband-name"&gt;&lt;/div&gt;&lt;div class="wife-husband-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- wife-husband-wrap closed here --&gt;
  
                  &lt;div class="occuption-wrap"&gt;
                      &lt;input class="occuption-field" type="text" name="fname" maxlength="40" size="14"&gt;&lt;div class="occuption-name"&gt;&lt;/div&gt;&lt;div class="occuption-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- occuption-wrap closed here --&gt;
                  &lt;div class="identity-wrap"&gt;
                      &lt;input class="identity-field" type="text" name="fname" maxlength="40" size="10"&gt;&lt;div class="identity-name"&gt;&lt;/div&gt;&lt;div class="identity-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- identity-wrap closed here --&gt;
                  &lt;div class="sign-wrap"&gt;
                      &lt;input class="sign-field" type="text" name="fname" maxlength="40" size="13"&gt;&lt;div class="sign-name"&gt;&lt;/div&gt;&lt;div class="sign-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- sign-wrap closed here --&gt;
                  &lt;div class="birth-wrap"&gt;
                      &lt;input class="birth-field" type="text" name="fname" maxlength="40" size="21"&gt;&lt;div class="birth-name"&gt;&lt;/div&gt;&lt;div class="birth-field-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;&lt;!-- birth-wrap closed here --&gt;
                  &lt;div class="childs-name-ages-wrap"&gt;
                      &lt;h4 class="childs-name-ages"&gt;&lt;/h4&gt;&lt;div class="childs-name-ages-no"&gt;&lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="name-age"&gt;
                      &lt;div class="nname"&gt;&lt;/div&gt;
                      &lt;div class="age"&gt;&lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="empty-name-age1-1"&gt;
                      &lt;input class="empty-name-field-1" type="text" name="fname" maxlength="40" size="15"&gt;
                      &lt;input class="empty-age-field-1" type="text" name="fname" maxlength="40" size="12"&gt;
                  &lt;/div&gt;
                  &lt;div class="empty-name-age1-2"&gt;
                      &lt;input class="empty-name-field-1" type="text" name="fname" maxlength="40" size="15"&gt;
                      &lt;input class="empty-age-field-1" type="text" name="fname" maxlength="40" size="12"&gt;
                  &lt;/div&gt;
                  &lt;div class="empty-name-age1-3"&gt;
                      &lt;input class="empty-name-field-1" type="text" name="fname" maxlength="40" size="15"&gt;
                      &lt;input class="empty-age-field-1" type="text" name="fname" maxlength="40" size="12"&gt;
                  &lt;/div&gt;
                  &lt;div class="empty-name-age1-4"&gt;
                      &lt;input class="empty-name-field-1" type="text" name="fname" maxlength="40" size="15"&gt;
                      &lt;input class="empty-age-field-1" type="text" name="fname" maxlength="40" size="12"&gt;
                  &lt;/div&gt;
                  &lt;div class="empty-name-age1-5"&gt;
                      &lt;input class="empty-name-field-1" type="text" name="fname" maxlength="40" size="15"&gt;
                      &lt;input class="empty-age-field-1" type="text" name="fname" maxlength="40" size="12"&gt;
                  &lt;/div&gt;
                  &lt;div class="empty-name-age1-6"&gt;
                      &lt;input class="empty-name-field-1" type="text" name="fname" maxlength="40" size="15"&gt;
                      &lt;input class="empty-age-field-1" type="text" name="fname" maxlength="40" size="12"&gt;
                  &lt;/div&gt;
                  &lt;table class="id-card"&gt;
                      &lt;tr&gt;
                          &lt;th colspan="15"&gt;&lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td class="daash" contenteditable='false'&gt;-&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                          &lt;td class="daash" contenteditable='false'&gt;-&lt;/td&gt;
                          &lt;td contenteditable='true'&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
                  &lt;table id="finger-prints"&gt;
                      &lt;tr&gt;
                          &lt;th colspan="15"&gt;&lt;/th&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;/td&gt;
                          &lt;td&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
                  &lt;div class="disc-maj-container"&gt;
                      &lt;div class="disc-maj-2-wrap"&gt;
                          &lt;input class="disc-maj-2-field" type="text" name="fname" maxlength="40" size="7"&gt;&lt;div class="disc-maj-2-name"&gt;&lt;/div&gt;
                      &lt;/div&gt;&lt;!-- disc-maj-2-wrap closed here --&gt;
                      &lt;div class="date-wrap"&gt;
                          &lt;input class="date-field" type="text" name="fname" maxlength="40" size="25"&gt;&lt;div class="date-name"&gt;&lt;/div&gt;
                      &lt;/div&gt;&lt;!-- date-wrap closed here --&gt;
                      &lt;div class="zila-number-wrap"&gt;
                          &lt;input class="zila-number-field" type="text" name="fname" maxlength="40" size="26"&gt;&lt;div class="zila-number-name"&gt;&lt;/div&gt;
                      &lt;/div&gt;&lt;!-- date-wrap closed here --&gt;
  
                  &lt;/div&gt;&lt;!-- disc-maj-container closed here --&gt;
                  &lt;div class="image-container" style="width:230px;height:275px;"&gt;
                      &lt;div class="domicile-pic"&gt;&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
  </code></pre>