validator dont work

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10039349
    cdoo
    Participant

    hello!

    i use the card form-wizard from your demo-site and it works great.
    i add the parameter “required” and “title” to set the input and select fields as required – this works great.

    but when i add new select options with javascrript to a existing select field with the “required” parameter it wont check if this select field is selected. the existing “required” parameter no longer has any function.

    							
    <form class="form-horizontal">
    											<div class="tab-content">
    												<div id="w1-account" class="tab-pane p-3 active">
    													<div class="form-group row pb-3">
    														<label class="col-sm-4 control-label text-sm-end pt-1" for="w1-username">Field1</label>
    														<div class="col-sm-8">
    															<select id="categorie" class="form-control mb-3" title="error_message" required="">
                                                                    							<option value="">- please selected -</option> 
            														<option value="1">Wert</option>
            													</select>
    														</div>
    													</div>
                                                        
    													<div class="form-group row pb-3" id="productbox" style="display: none;">
    														<label class="col-sm-4 control-label text-sm-end pt-1" for="w1-username">Field2</label>
    														<div class="col-sm-8">
    															<select id="product" class="form-control mb-3" title="please select product from dropdown" required="">
                                                                								<option value="" selected>- please select options loaded based of selection from Field above  -</option> 
            													</select>
    														</div>
    													</div>
    							</div>

    and the javascript is this:

    
    var product_array = [{"kat":1,"produkt_id":1,"produkt_be":"Test1"},{"kat":1,"produkt_id":2,"produkt_be":"Test2"}];
    
    $('#categorie').change(function() {
       var catid= $(this).val();
       var filtered = product_array.filter(a => a.kat == catid);
       $.each(filtered,function(i,d){
           $('#product').append($('<option/>', {
               value: d.produkt_id,
               text: d.produkt_be
        }));
      });
       
       $("#productbox").show();
       $('#productbox').attr('required', true);
       
    });
    


    Template Version: actual version
    #10039352
    Support
    Keymaster

    Hello, I’m sorry but I’m not sure I understand the question, what you actually want is that when you add the required attribute using Javasript the validator must initialize again considering that field?

    If possible send us the url so we can make a few tests.

    Looks like it’s not actually related to the template files.

    Thanks.


    #10039353
    cdoo
    Participant
    This reply has been marked as private.
    #10039356
    Support
    Keymaster
    This reply has been marked as private.
Viewing 4 posts - 1 through 4 (of 4 total)

This topic is marked as "RESOLVED" and can not rceive new replies.