- This topic has 3 replies, 2 voices, and was last updated 4 years, 9 months ago by
Support. This post has been viewed 1072 times
-
AuthorPosts
-
September 17, 2021 at 5:17 pm #10039349
cdoo
Participanthello!
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 versionSeptember 18, 2021 at 8:29 pm #10039352Support
KeymasterHello, 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.
September 20, 2021 at 3:55 am #10039353cdoo
ParticipantThis reply has been marked as private.September 20, 2021 at 10:43 pm #10039356Support
KeymasterThis reply has been marked as private. -
AuthorPosts
This topic is marked as "RESOLVED" and can not rceive new replies.