Hello,
I'm trying to set focus to the first control, a textbox, on a dynamic form.
I've tried the following JQuery code inside the header field of a DNN html module:
$(function() {
$("#dnn_ctr1219_DynamicForms_TBR_GUID9ad85ae1-23a4-48b1-a081-a383fbd499f1Name").focus();
});
Where 'dnn_ctr1219_DynamicForms_TBR_GUID9ad85ae1-23a4-48b1-a081-a383fbd499f1Name' is the ID of the textbox.
This works, in the sense that focus is set and I can start typing in the textbox. But the cursor stops blinking and disappears altogether depending on where I move the mouse cursor.
So I tried putting the same code without the block in the form itself. I put this at the following location:
Module Configuration > Advanced Coding Options > Custom JavaScript File > Initial Javascript
I couldn't see any reference to JQuery, but i thought it would be worth a try. This worked by setting focus but the cursor behaved as above.
I tried using the same code on a textbox that is not inside a dynamic form and this worked perfectly.
So could someone please tell me what I am doing wrong? How can I set focus to a textbox and make the cursor blink normally?
Also, where JQuery code should go within a dynamic form?
Do you have any examples of how to use JQuery in a dynamic form, I couldn't see anything in the user manual.
Best Regards,
Steve