kokonauta Posted July 12, 2017 Share Posted July 12, 2017 Hi, I need some help to achieve a customization on checkout address:I want to show the ID Card field only on certain states of a specific country but i don't know how to work arround this.The problem is that It can be configured the ID card field for the whole country, but not for certain states.I think that is possible to make a conditional to show the field but I don't know how to check if is the desired country and states. Once solved this first part, the second problem is how to make the ajax call to update the field on a state change.I would aprecciate any information to progress in that customization.Thanks in advance. Link to comment Share on other sites More sharing options...
kokonauta Posted July 12, 2017 Author Share Posted July 12, 2017 (edited) I have achieved part of the desired with this code on order-opc.jsNow the field is visible on the specific states, and hidden on the other states$('#id_state').on('change', function() { if($('#id_country').val() == 6){ if( $('#id_state').val() == 339 || $('#id_state').val() == 351 || $('#id_state').val() == 363 || $('#id_state').val() == 364 ){ $('.dni').show() }else{$('.dni').hide()} } }) Now the only problem is how to validate the field as required and output error when the field is not well filled. (The field is not required normally because all the other states not require fill the field) Edited July 12, 2017 by kokonauta (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now