logo
Tags down

shadow

Can't validate input in PROLOG


By : Rene Perrin
Date : October 18 2020, 01:08 AM
fixed the issue. Will look into that further I don't really speak spanish and can't test your code, but from what I see the problem lies in preguntar_duracion(RtaDuracion):
code :
preguntar_duracion(RtaDuracion):-  
   write('¿Tenés bastante tiempo libre? Respuesta (si|no): '),  
   read(RtaDuracion),  RtaDuracion \= si, RtaDuracion \= no, 
   writeln('Respuesta inválida, conteste nuevamente.'), 
   preguntar_duracion(RtaDuracion).  
preguntar_duracion(RtaDuracion):-  
   write('¿Tenés bastante tiempo libre? Respuesta (si|no): '),
   read(TempRtaDuracion),
   (   TempRtaDuracion \= si,
       TempRtaDuracion \= no
   ->  writeln('Respuesta inválida, conteste nuevamente.'), 
       preguntar_duracion(RtaDuracion)
   ;   RtaDuracion = TempRtaDuracion
   ).


Share : facebook icon twitter icon

Validate triple input box phone number field with jquery validate


By : user4723232
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I kept the original solution. The validation errors on the first two fields goes away when you click on them or submit form. Not ideal but not a show stopper!

validate array of inputs using validate plugin jquery - show errors for each input


By : yanxi
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Here is a workaround to your issue.
Explanation The var validator = ... is used to provide a template to the inputs with email[] names.
code :
var emailCounter = 1;

var validator = $(".webapp_auth_login_validation").validate({
  rules: {
    "email[]": "required"
  },
  messages: {
    "email[]": "Please enter you email"
  }
});

var createValidation = function() {
  $(".email-input").each(function() {
    $(this).rules('remove');
    $(this).rules('add', {
      email: true,
      required: true,
      messages: {
        email: "Not a valid email.",
        required: "Please enter an email adress."
      }
    });
  });
}

$('.webapp_js_cu_email_new').click(function() {
  $('.webapp_js_cu_email_container').append('<div class="col-md-4 form-group"><label>Additional Email: <span class="text-danger">*</span></label><a href="javascript:void(0);" class="webapp_js_cu_email_remove" title="Remove field"> Remove </a><input id="email[' + (emailCounter) + ']" type="text" name="email[' + (emailCounter) + ']" class="form-control required email-input"></div>');

  // Increment input counter
  ++emailCounter;

  // Create validation
  createValidation();
});

$('.webapp_js_cu_email_container').on('click', '.webapp_js_cu_email_remove', function(e) {
  e.preventDefault();
  $(this).parent('div').remove();
});

// Kick validation
$(document).ready(function() {
  createValidation();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<form class="webapp_auth_login_validation">
  <div class="row webapp_js_cu_email_container">
    <div class="col-md-4 form-group">
      <label>Email Address: <span class="text-danger">*</span>
      </label> <a href="javascript:void(0);" class="webapp_js_cu_email_new"> Add </a>
      <input type="text" name="email[0]" class="form-control required email-input">
    </div>
  </div>
  <input type="submit">
</form>

Validate an input field in HTML having 2 buttons. Validate only for one button click


By : The Dilixir Alonez-
Date : March 29 2020, 07:55 AM
hope this fix your issue This is the HTML file. There is no used in this. There are two buttons in this HTML. Using angularJS2( typescript ) , You can set the value of required on button click
code :
<div class="visitor-entry form-group" >
  <!-- [ngClass]="{'validate':vName.errors && (vName.dirty || vName.touched)}"-->
  <div class="ui-input-group"  >
    <input #vName="ngModel" type="text"  class="form-control" placeholder="Name*" name="visitorName" [(ngModel)]="visitorName" [ngClass]="{'validate':vName.errors && (vName.dirty || vName.touched)}" [required]="{{reqVal}}">
    <span class="input-bar"></span>
  </div>
  <div class="ui-input-group">
    <input type="text" class="form-control" placeholder="Mobile" name="visitorMob" [(ngModel)]="visitorMob">
    <span class="input-bar"></span>
  </div>
  <div class="add-btn-cont">
    <button  [disabled]="vName.errors" class="icon-btn" id="addVisitor" title="Add" (click)="addVisitor();reqVal=false"></button>
  </div>
</div>

<div class="block search-add-list active">
    <h6>Person Affected
      <button class="icon-btn pull-right addNewBtn" title="Add New" data-toggle="modal" id="personAffectedBtn" (click)="addNewPerson(personAffectedCode);reqVal=true"></button>
    </h6>
</div>

How to validate input, in non-form element, on keyup with jQuery validate plugin


By : mangochiman
Date : March 29 2020, 07:55 AM
wish helps you You cannot have nested forms, which is invalid HTML, and you must attach .validate() to a form container. There are no workarounds.
You're also using .validate() all wrong. Since this is the primary initialization method of the plugin, wrapping it within a keyup handler is not correct. Plus the plugin already uses the keyup event to trigger validation.

Prolog - 'unknown clause' error message when asking for user input when using PIE (Prolog Interface Engine)


By : user2105795
Date : March 29 2020, 07:55 AM
I hope this helps you . Note: In a comment the OP noted this was originally done using PIE (Prolog Interface Engine)
Your problem is that you are using read/1 which expects a Prolog term. Prolog terms are not strings that can be of any form, Prolog terms end with a period (.). So in your example input(). works because it ends with a period, hello does not work because it does not end with a period.
code :
?- input().
|: input().
input()
true.
?- input().
|: hello
|: .
hello
true.
Unknown clause found read(X$0)
shadow
Privacy Policy - Terms - Contact Us © soohba.com