Chris Huber

Greenhorn
+ Follow
since Mar 26, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Huber

And now I just realized that my method will clear any data entered each time a field is added. I need to come up with another way.
Getting very close... I am using a counter and reference it with:
document.inputform.elements["documents[]"][counter].focus();

Focus works the first time it adds a field in IE8, but when you add a third, forth, etc. field the focus doesn't change (just goes away). I don't get a JavaScript error.

It works every time in Firefox.


I don't know where to begin on traversing multiple elements with the same name.

The jQuery does look trivial - but keep in mind that the value would be blank... so I assume I would tell it to focus on a value that is blank, which doesn't sound like a good idea.
There is such a thing as an array on an html form... simply use <input type='text' value='Apples' name='fruit[]'> and <input type='text' value='Oranges' name='fruit[]'> and on the server side you can retrieve the value of fruit as an array. How would you set the focus on the second field (Oranges) using focus()?

I have an entry form that is dynamic (any number of items can be added.) The user clicks a button to add another entry. The html form field is an array. It works perfectly except I can not figure out how to change the focus through javascript.

My question is, what would be a way to change focus on an input that has is being built dynamically and has the same name? I want the latest created field to have the focus.

I solved it by nesting the popup within the span.

I have a popup that is similar to a 'google suggest' where it creates a drop-down based on the text after each onkeyup... There will be multiple fields like this on a page.

I'm struggling with hiding the popup if the user clicks outside the input box or tabs to the next field. I really want to use onblur, which seems to be designed exactly for this - except when I use it, it hides the popup when you click on a selection in the popup box - prior to it executing the script to put the value in the input box. If it could execute the clicked on action, then hide the box, it would work perfectly.

I'm trying to avoid using the 'find the mouse cursor click and determine if it is inside or outside the popup...' method. With that method I also have to take into account if they tab outside the input box.

Any suggestions?

Here is the slimmed down code:
I can edit the text in the span with contentEditable='True' if I do not have a span prior to it... but if I have <span></span> prior to it, the first character is un-deletable (and it moves the element to the right with each press of the delete or backspace key). This only happens in Firefox.

Can anyone explain?

*Note - made minor edit to code

I get 'event is not defined' in Firefox at the line:

if (!event) {

I've see then if(!event){...} code used often for non-IE work arounds, so I'm not sure that is what I am doing wrong.
This is a basic script that should pop up once the object is clicked... It works in IE, but not Firefox. Any thoughts?

I'm new to closures, but I understand what that example script does. I'm not sure how to apply it to my script.
I'm trying to create a generic AJAX function that has the data field passed to the function in order to return the results to the proper place.

Oddly enough, this does not work if I comment out the 'alert' line in the set_output, however it does work if I have it pop up those variables.

Either way, I do still get a type-mismatch on the line:


I figure that is because you shouldn't pass variables to a function in this way.



Any suggestions would be greatly appreciated!
[Edit: thread hijack removed. Ask your own questions in new topics.]