Hello,
I try to find the input field of a subform with the id "jform_flds__fldsx__tlfc", and x=0...n"
My
goal is, if a field has already a saved value, it must be readonly. I
can't do this for the subform in the model function getForm or is this
possible? \
Another thing, on the subform you can add the
property "onchange", but not "onload", or am I wrong? Because than I
could do it there like an onchange event.
So I thought I do it in the edit.php with jQuery if the document is ready.
Here is my code:
<script type="text/javascript">
jQuery('document').ready(function() {
//jform_flds__flds0__tlfc
jQuery( window ).on( "load", function() {
jQuery('input[id^=jform_flds__flds][id$=__tflc]').each(function() {
//jQuery(this).attr('readonly','readonly');
console.log('test2: ' + jQuery(this).val());
});
console.log('testx');
}); //END jQuery( window ).on( "load", function() {
});
</script>
If I change the line:
jQuery('input[id^=jform_flds__flds][id$=__tflc]').each(function() {
Into, without [id$=__tflc] :
jQuery('input[id^=jform_flds__flds]').each(function() {
then all the fields of the subform are returned
I hav tried with and without the line:
jQuery( window ).on( "load", function() {
Has
anybody an idea why it is not working? What can be the reason. I have
such thing made on another subform and there it is working, I don't see
the difference.
And next, to improve this selector should be checking on the digits by regular expressionn like:
jQuery('input[id^=jform_flds__flds\d{1,2}__tflc]').each(function() {
I hope that someone can help me to find the issue.
--
Met vriendelijke groet,
Nico van de Kamp
Laakse Laan 37
7207 NA Zutphen
06-27371402