I have a form for registering for training classes. 5 fieldsets:
class info
participant info
button bar
customer's company info
reset and submit buttons
The third fieldset -- the button bar -- consists entirely of <button>s.
They do many DOM manipulation stuff like allow one user to register many people at the same time (by adding a new participant info fieldset dynamically), etc.
Anyway, I only want the button bar to be created if the brower is capable of doing the things the buttons do. So, I create the fieldset with some js&DOM onload. If the client doesn't understand how to use the buttons, it won't understand how to build them in the first place.
Wonderful.
My problem is, the buttons are created with type='submit' by default. There are two other options, 'reset' and 'button'. I'd like to set the type='button' so I can attach onclick events to do what I want. No can do, my browsers tell me -- type is readonly.
Is there a way I can create the buttons with type being button rather than submit?
If not, is there another solution?
I tried adding onsubmit event, which did the actions I want and always returned false...hoping that would stop the submit action.
That didn't work either. Seemed the buttons just ignored the rest of the function and the form ignored the return false and submitted the form anyway.
From: Somewhere over the rainbow Insane since: Mar 2001
posted 06-17-2004 08:54
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
I wrote a bit of code that simulates a button that is created dynamically. It is a 3 image based button that switches state following the up, hover, and down events. The onclick event can be redirected to any function on the page as well. That could be a way to go on this. I remember trying to create some form elements on the fly and I ran into all sorts of trouble so that is why I ended up creating this button code to get around it. If you think that sort of thing may be useful then I would be more than happy to show you how I did it and maybe you could tailor it to your needs.
It would be interresting to hear Slime talking about the creation of form fields with the DOM. I remember he had some problems with some bugs in IE while he worked on the GUI of his 2nd JavaScript Raytracer.
I'm tyring to work on a collection of javascript objects that all work nicely together and when you look at the code, there will be a fair amount of overhead in it. So do a "save as" and take a look at each of the js files that I include on this page to get the full picture.
I'm sure it can be stripped down to a compact version to fit your needs if you decide it will do what you want. If you would like any help with any of it just let me know.
poi, please go easy on me. This library is very much a work in progress and I hadn't planned on revealing much of it just yet. But if do have any feedback, I'll gladly take it all the same
what does it mean ? I'm not a croquemitaine ( the French version of the "bogeyman" ).
Your code looks nice. The only thing that puzzles me is that you base your cross browser ( backward ) compatibility on a browser detection instead of a ( forward compatibiliy based on ) property detection. For instance I would write the getoOpacity() that way :
poi, I didn't mean anything against you at all, just the opposite actually (whether or not you're a croquemitaine is perhaps a subject for another thread ) I was expressing my own insecurity since I don't have as much time anymore to devote to keeping up the latest scripting techniques. I appreciate your peer reviewing.
Anyway, I think I haven't fully thought out the browser sniffing issue. I will bring this up in the dhtml forum more when I get closer to working on that more. I value very highly the input that you, InI, and others offer over there.
mobrul, I hope this is not too far afield from what you need.
I looked at my methods a little closer and I must say that I don't have a good reason for using browser detection instead of property detection. A long time ago, I did a little of both methods but I just got into the habit of detecting browsers and never put much more thought into it since that time. I will reconsider that as I continue to develop this collection of code.
Hey mobrul! Where you be? How are things coming along?
From: Somewhere over the rainbow Insane since: Mar 2001
posted 06-18-2004 09:24
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
InI+Bugimus: yep, browser or object detection is questionnable. Not so long ago I used browser detection because the real problem was the backward compatibily. But with the recent boost of activity in the browser world, I tend to think in term of forward compatibiliy. Many sites were broken when Netscape 6 came out. On one hand it generated some contracts to fix them, but it also put some doubts on the companies who did those sites in the first place as the problems were avoidable.
Bugs, that's slick. I dig it.
I think, for sure, this'll be something I can use...and it won't take much modifying at all.
I got pulled off onto another little PHP-COM-excel issue, but will be back to this DOM (or damn...) thing full-speed this weekend.
Thanks.
InI, I see now what you mean.
I was looking at the issue, perhaps, a bit too narrowly.
What are the compatibility issues if innerHTML? Anything in particular I need to watch for?
Sweet. I will be out of town this weekend but I will be online via dialup for some of that time. I would very much like to chat with you if we get online at the same time.
About innerHTML, the main problem with it is that it is still a non-standard hack. Don't get me wrong, I love it to death but if the W3C doesn't bless it, then we really should try to avoid it. I'm sure InI can elaborate more on the pitfalls associated with it.
From: Somewhere over the rainbow Insane since: Mar 2001
posted 06-19-2004 23:25
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
From: Somewhere over the rainbow Insane since: Mar 2001
posted 06-20-2004 12:51
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
Now that is a very interesting page! It really pissse me off that I've been spending so much time learing the "right" way of doing things when it is so $%&&#@#@ slow!!! Ugh...
I had wanted to try the cloning method to see if that would help and now I see even that is going to yield minimal improvements.
That's in those moments that I appreciate the many hours I spent working on my raycasting engines in JavaScript trying to find the optimal method for every part of them.