logo
down
shadow

Require that form fields are filled before saving a record


Require that form fields are filled before saving a record

By : Mira Izzati Mohd Paw
Date : November 22 2020, 10:38 AM
it should still fix some issue Supposing that validate() is the function that will check that every field is filled, you need to call it in the before_update event of the form. This is the function:
code :
Function validate() as Boolean
  Dim ret as Boolean
  If (textbox1.Value & "") = "" or (textbox2.Value & "") = "" or ... Then
    ret = false
  Else
    ret = true
  End If
  validate = ret
End Function
Private sub Form_BeforeUpdate(cancel as integer)
    If not validate() then 
       MsgBox "Fill all required fields, please"
       cancel = true
    End If
End Sub


Share : facebook icon twitter icon
How do I enable saving of filled-in fields on a PDF form?

How do I enable saving of filled-in fields on a PDF form?


By : bob
Date : March 29 2020, 07:55 AM
it should still fix some issue When you use Acrobat 8, or 9, select "enable usage rights" from the Advanced menu. This adds about 20 kb to the pdf.
The other possibility is to use CutePDF Pro, add a submit button and have the XFDF data submitted to your self as an email or to a web server. The XFDF data can then reload the original PDF with your data.
PHP Validation to require One of Two Form Fields filled in

PHP Validation to require One of Two Form Fields filled in


By : SATHEESH KOTAPATI
Date : March 29 2020, 07:55 AM
will be helpful for those in need I am developing a site that uses javascript to handle many functions and PHP based Captcha code to validate the form field. , Try this,
code :
if($_SESSION['security_code'] == $_POST['security_code'] && (!empty($email) || !empty($phone))) {
if ($_SESSION['security_code'] == $_POST['security_code']) {
How can I require two - and only two - of four foreign key fields in a model to be filled?

How can I require two - and only two - of four foreign key fields in a model to be filled?


By : Jocelyn
Date : March 29 2020, 07:55 AM
I wish this help you You can add some validation at the model's level (either directly in the save method or using the validation api cf https://docs.djangoproject.com/en/1.10/ref/models/instances/#validating-objects), but this won't be enforced at the database level nor during a QuerySet.update operation (cf https://docs.djangoproject.com/en/1.10/ref/models/querysets/#update).
HTML form - If one of these 3 fields is filled, all should be filled

HTML form - If one of these 3 fields is filled, all should be filled


By : Hatim Nazeri
Date : March 29 2020, 07:55 AM
Hope this helps I made some changes on @Siphalor's answer and I found what I needed. Below is the edited script that works form me:
code :
function doInputRequireGroups()
{
  var groups = document.getElementsByClassName("input-require-group");

  for(var i=0; i < groups.length; i++)
  {
     let inputs = groups[i].getElementsByTagName("input");

     for(var j=0; j < inputs.length; j++)
     {
       inputs[j].style.color="1px solid green";

       inputs[j].addEventListener("keyup", function()
       {
         //Only remove the required attribut if all the fields are empty.
         if(inputs[0].value=="" && inputs[1].value=="" && inputs[2].value=="")
         {
           for(var k=0; k < inputs.length; k++)
           {
             inputs[k].required=false;
           }
         }
         else
         {
            for(var k=0; k < inputs.length; k++)
            {
              inputs[k].required=true;
            }
         }
       });
    }
  }
}
How can I use Javascript to error check an HTML form, including verifying fields are filled and filled correctly?

How can I use Javascript to error check an HTML form, including verifying fields are filled and filled correctly?


By : user3251893
Date : March 29 2020, 07:55 AM
This might help you As I've stated in the comments, I recommend the jquery validation plugin. Below is how you would validate your phone number using the plugin. If you read the documentation you'll see there are many many examples. Here is a demo: https://jsfiddle.net/6gojrte2/
HTML Markup:
code :
    <form id="myform">
        <label for="phone">Phone: </label>      
        <input name="field" placeholder="000-000-0000"><br/>
        <input type="submit" value="Validate!">
    </form>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
<script>

$(document).ready(function () {

    $( "#myform" ).validate({
      rules: {
        field: {
          required: true,
          phone: true     
        }
      }
    });

    jQuery.validator.addMethod("phone", function (phone_number, element) {
            phone_number = phone_number.replace(/\s+/g, "");
            return this.optional(element) || phone_number.length > 9 &&  phone_number.match(/^\(?[\d\s]{3}-[\d\s]{3}-[\d\s]{4}$/);
    }, "Invalid phone number");

});
</script>
<script>

 $("document").ready(function(){

      $("#submit").click(function(){
        checkPhone($('#phone').val());
      });
 });

    $("#phone").keyup(function(){      
      checkPhone($('#phone').val());
    });

    function checkPhone(inputtxt){

      var phoneno = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
      if($.trim($("#phone").val())==""){          
        $("#errorphone").html("<p>You missed your phone number</p>");
        $("#errorphone").addClass("showerror");
      }
      else if((inputtxt.match(phoneno))==false || inputtxt.length < 12){          
        $("#errorphone").html("<p>Please enter your number in the format 000-000-0000</p>");
        $("#errorphone").addClass("showerror");
      }
      else{       
        $("#errorphone").html("");
        $("#errorphone").removeClass("showerror");
      }
    }

</script>
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org