Categories > TinyButStrong general >

How to change field focus in a template?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Brandon Sussman
Date: 2008-04-01
Time: 02:42

How to change field focus in a template?

I want a template to cause the focus to shift to one of the fields in a from generated from that template ( IE
document.formname.fieldname.focus()
)

What am I missing - can I do this completely in the template.

Right now I have a very messy solution that has the main php file using <body onload... But this makes a terrible dependency on the field name that is in the template.
By: Anonymous
Date: 2008-04-01
Time: 15:17

Re: How to change field focus in a template?

I see no reason why you can't do it. To me, it's all about
<script type='text/javascript'>
document.getElementByTagName('idOfMyFormField').focus();
</script>

Or are you asking something else, that I'm missing?
By: Anonymous
Date: 2008-04-01
Time: 15:18

Re: How to change field focus in a template?

oops sorry,
document.getElementById('...'), not tagname.