[Resolved]Putting cursor into text input field
#1
Posted 11 April 2008 - 04:22 PM
Does anyone know how to do it?
Thank you
Paul.
#2
Posted 11 April 2008 - 04:24 PM
sorry I cant be of more help
#3
Posted 11 April 2008 - 04:47 PM
isn't it done with a onload() in the body?
sorry I cant be of more help
Thanks Dean, that was enough I think of a clue.
I am going to try something like this:
<script type="text/javascript">
function placeCursor()
{
FormName.ElementName.focus();
}
</script>and in the body tag
<body onload="placeCursor()">
With more thanks to the fabulous w3c schools and of course Google :-)
#4
Posted 11 April 2008 - 05:13 PM
Instead of putting the javascript line in a function, it works with just this too...
<body onLoad="add_todo.title.focus();"> (add_todo is my form name and title is the input-field name.)
I shall look into why it doesnt work in firefox.
Thanks again Dean for your help.
Paul.
Edited by PaulD, 11 April 2008 - 05:14 PM.
#5
Posted 11 April 2008 - 05:30 PM
The other option is to find a site that does it and copy their source.
#6
Posted 11 April 2008 - 07:14 PM
NP - Sometimes just a little bit of information is enough to give you a headstart.
The other option is to find a site that does it and copy their source.
google.co.uk ?
#7
Posted 11 April 2008 - 07:59 PM
<body onLoad="document.forms.name_of_form.name_of_input.focus()">
#8
Posted 11 April 2008 - 09:11 PM
#9
Posted 13 April 2008 - 02:51 AM
Thanks Darren, that works perfectly, thank you.this should work:
<body onLoad="document.forms.name_of_form.name_of_input.focus()">
The other option is to find a site that does it and copy their source.
Googles onload body tag isgoogle.co.uk ?
sf();if(document.images){new Image().src='/images/nav_logo3.png'}As soon as you said onLoad though, I had something to look for. Thank you.Thanks Ralph, I thought tabindex started at 1.Depending on the complexity of the page, tabindex might be helpful...
I have decided that my list application can't be just php and css, and that I have to go back to javascript. In fact it makes sense to have most of the work done client side. My attempts with script bits from various sites failed. I tried to simplify the page for speed of loading almost to a single list, but navigation became a problem. Then the options mounted up, add, edt, delete, add a note, show note, sort, move to scratchpad, copy to template blah blah. Even then I got about 70% done before I realised that it was clunky, almost impossible to properly use.
I have to use drag and drop. I have to use sortable lists. I want to use sliding out folders and fade affects etc etc. For the todo lists anything else is just same old same old. Tables with millions of icons each representing a different task. Each click an entire reload of the page.
Anyway, I am going to try a 'proper' javascript library, although the ones I have looked all have their good and bad points. I am tempted to use scriptaculous, it seems so accessible and their demos (for the bits I want to use) all seem to work. I have also found jQuery which looks cool, and there is another one from extjs which looks the business but is not fully open source.
Does anyone have any preferred libraries they would reccomend or ones to avoid? Before I plough into learning one only to discover a pitfall later.
Thanks for the help again,
Paul.
PS sorry to rattle on.
#10
Posted 13 April 2008 - 11:25 AM
Does anyone have any preferred libraries they would reccomend or ones to avoid? Before I plough into learning one only to discover a pitfall later.
I have used scriptaculous a bit. The prototype library it is based on is ok but I wouldn't recommend scriptaculous for more complex things as tree structures. Etomite uses scriptaculous for sorting the menu index but for drag & drop moving I gave up using the library and had to code the d&d from scratch. I found scriptaculous quite buggy and for large compex structures scriptaculous is simply too slow as it doesn't rely on the browser's built in events to get the item we are dragging over. Instead it loops through the whole dom structure, calculates the absolute positions of all the elements and compares them with the cursor position. The only advantage with this is that the dragged element can be placed directly under the cursor. In my opinion, placing the dragged element slightly off is a good tradeoff for better performance.
Now I work with extjs instead and that library's tree structure is superb. It is also quite light weight and fast compared to similar libraries. As you know it also has all the usual desktop controls as tabs, grids, menus etc. It is harder to learn but in my opinion it is the best library out there. The Yahoo User Interface is also an alternative to check out. I know Ralph has used it quite a bit but I prefer extjs because of it's, in my opinion, superior d&d and tree functions.
If you just need some basic d&d table sorting I could still recommend scriptaculous but if your project grows more complex I would suggest you look somewhere else.
My two cents
#11
Posted 14 April 2008 - 12:53 AM
Some libraries have pros and cons, depending on the type of framework you want to rely on
You should also have a look at Mootools demo : http://demos.mootools.net/
since many libraries are built upon this one...
Hope it helps.
deadline
#12
Posted 14 April 2008 - 01:10 AM
Wouldn't it be nice if....Eto provided THE REST OF THE interface for building out Rich Internet Applications (RIAs)?
What we have now is a wonderful tool for building a server-side component driven architecture. It would be wonderful to see the addition of another complete set of interface components designed to support ONLY the client side components via ONE standardized JS architecture. This would go beyond "chunks" to entire JS interface descriptions, JS stand along components, JS prebuild widgets to add to pages (much like snippets now), etc., etc., etc.
This is different than simply including JS as anyone that has build a real interface with any of these JS APIs will tell you. nalagar and I have worked together on a couple of projects here and he knows I too am a HUGE fan of ExtJS. ExtJS would get my vote hands down.
Sorry to HIJACK this thread!
Moved to the wish list
#13
Posted 15 April 2008 - 10:38 PM
I started to play with scriptaculous and it really is scriptaculous! Then after nalagars comment I looked again at extjs and it really does look and feel solid. I took a quick look at mootools too, but the yahoo user interface just blew me away! I mean wow.Their slider widget I have been trying to do for ages and ages (with really bad results). Their drag and drop was not impressive at all.
I want to use extjs on todo.me.uk for the drag and drop, but might spend a bit longer with scriptaculous because, as you say, it looks a little easier to use. But I am definitely going to use yui for frimp.co.uk so that users can rate music with an area slider.
Well thats the plan.
I have seen some uber-cool sites recently. I am falling in love with javascript but have yet to get anything to really work properly.
Thanks for the input everyone. Really appreciated.
Paul
PS Randy, your vision for eto is cool! Can I have it now please :-)
#14
Posted 17 April 2008 - 08:15 PM
I played with scriptaculous and it quickly starting exhibiting quirky behaviour. Also I couldn't drop a node into a sortable list as a child unless there were already existing children. This appeared from the chaotic forums to not be possible, neither using guide li's or ul's with min heights.
I have now started with ExtJs and the experience of the easier scriptaculous has really helped. ExtJs is really really good. Sooooooo much better in feel than scriptaculous. Just thought I would let anyone else know that Randy and Nalagar were right!
Thanks again for the advice
Paul
:-)
#15
Posted 17 April 2008 - 08:18 PM
Is this OK to close now?Just a note to finish off.
Be sure to blog about how you get on!
#16
Posted 17 April 2008 - 09:04 PM
Is this OK to close now?
Of course. Sorry, I do go on.
Paul.
#17
Posted 17 April 2008 - 09:16 PM
The issue this topic was opened for has been resolved, and we look forward to helping you in the future. If you need further assistance, please open a new topic.
This topic will now be marked as Resolved. If you are satisfied with the support provided here at Etomite (or just appreciate the service we provide), you may want to make a donation to help cover forum and server costs in order to help this quality support continue. If you wish to donate, click Here
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users


This topic is locked








