number 9999 comes out as value in the xml?
maybe someone here can help:
I because if there is nothing in the field, the number 9999 comes out in the xml as value
<input type="hidden" name="Geburtsjahr_Sorgeberechtigter_1" value="9999"> <input type="hidden" name="Geburtsjahr_Sorgeberechtigter_2" value="9999"> <div class="col-xs-3" style="width: 187px;">Geburtsjahr</div> <div class="col-xs-4" style="width: 272px;"> <div class="form-group"> <input type="text" class="form-control" style="width: 125px;" placeholder="JJJJ" name="Geburtsjahr_Sorgeberechtigter_1" id="Geburtsjahr_Sorgeberechtigter_1" value="{if $pdf}{$values.Geburtsjahr_Sorgeberechtigter_1}{/if}" maxlength="4" min="1900" max="2100"> </div> </div> <div class="col-xs-3"> <div class="form-group"> <input type="text" class="form-control" style="width: 125px;" placeholder="JJJJ" name="Geburtsjahr_Sorgeberechtigter_2" id="Geburtsjahr_Sorgeberechtigter_2" value="{if $pdf}{$values.Geburtsjahr_Sorgeberechtigter_2}{/if}" maxlength="4" min="1900" max="2100"> </div> </div> // Geburtsjahr $(document).ready(function(){ $('#Geburtsjahr_Sorgeberechtigter_1').on('input', function(){ var eingabeWert = $(this).val(); if(eingabeWert === ''){ eingabeWert = '9999'; } $('input[name="Geburtsjahr_Sorgeberechtigter_1"]').attr("value", eingabeWert); }); }); $(document).ready(function(){ $('#Geburtsjahr_Sorgeberechtigter_2').on('input', function(){ var eingabeWert = $(this).val(); if(eingabeWert === ''){ eingabeWert = '9999'; } $('input[name="Geburtsjahr_Sorgeberechtigter_2"]').attr("value", eingabeWert); }); });
If I interpret your concerns and circumstances correctly, there are, for example, the following possible solutions:
Otherwise following your jQuery approach ( demo ):
Add data-default-years="XXXX" to inputs that should share this behavior.
Du könntest mit einer XSD einen entsprechenden Defaultwert festlegen:
https://de.wikipedia.org/wiki/XML_Schema