When it first makes them unrequired it seems to work as expected. However if I make them required then switch back to unrequired then the 'Other' selection is saying it's required from then on out. So it expects the "Other" field to always be checked. The "dayList<Input/Span>" variables are for the checkbox field. The "date<Input/Span>" variables are for a date field and that one is working just fine.
Note: The hide and show of the span is working as it should.
01 | function setRequired(dayText, isRequired) { |
06 | var dayListSpan = $( '.day' + dayText + 'Symptoms span.cf-required' ); |
07 | var dayListInput = $( '.day' + dayText + 'Symptoms input' ); |
09 | var dateSpan = $( '.day' + dayText + 'Date span.cf-required' ); |
10 | var dateInput = $( '.day' + dayText + 'Date input' ); |
11 | var dayEnteredByInput = $( '.day' + dayText + 'EnteredBy input' ); |
16 | dayListInput.attr( 'required' , 'True' ); |
19 | dateInput.attr( 'required' , 'True' ); |
22 | dayEnteredByInput.val(currUser).change(); |
27 | dayListInput.removeClass( 'required' ).removeAttr( 'required' ); |
30 | dateInput.removeClass( 'required' ).removeAttr( 'required' ); |
33 | dayEnteredByInput.val( '' ).change(); |
Note: the reason for passing it "dayText" is that I have several tabs with the same data being entered and only the slight name change, so I'm passing in the different part of the name and using that to get the exact fields. The Users did not want to use a collection.