[Javascript] Which submit caused the event?

Tedd Sperling tedd at sperling.com
Wed Jan 2 12:53:42 CST 2013


On Jan 2, 2013, at 11:52 AM, Hassan Schroeder <hassan at webtuitive.com> wrote:

> On 1/1/13 7:48 PM, Mike Dougherty wrote:
> 
>> Should this event registration even be done in markup?  If the script tag
>> with the document.onclick registration failed for some reason, this form
>> would be completely broken.
> 
> /*smacks head*/

/* smacks head quite often trying to get stuff to work */

http://rebel.lcc.edu/sperlt/citw185/bad-coding.php  <== for humor

All of you have valid points -- Please understand I presented a very simple case to solve a single problem. I did not consider all your perspectives, but I did consider:

---

First, as to progressive enhancement (Paul et all) -- I agree *provided* you are developing a web site -- I am not.

Instead I am working on a web application that will be used by a private concern. They (and I) want the solution to be application-like. Thus, it *will* be required for the user to have javascript enabled.

Granted, I have not considered all the problems that might be encountered by the disabled using my application. Being disable myself, I am sensitive to such failings. However, the users of my private application will not be disabled -- OR -- they will be provided an assistant. That's in the contract. As such, I consider progressive enhancement a moot point in this case. (expecting to hear reasons to the contrary).

In any event, here's a one of my web-application examples:

http://php1.net/a/zipcode-states/

Please realize that this is not meant as a web-site, but rather a web-application. If anyone has room-for-improvement, your comments will be welcomed.

In my private practice, I am seeing more call for developing web-applications than webs-sites -- your mileage may vary. This might be an interesting topic to discus.

---

Second, I am a long ways from publishing any js for serious consideration -- in that regard I'm a novice. My expertise (if any) is elsewhere.

I am just trying to understand how I can use js to stop the typical web-refresh on forms. I have been able to do it on some forms very successfully (or so I think, your opinion may differ).

However, on other forms I'm having minor problems -- little things like checkboxes being 'on' instead of '1' and why I can have a checkbox that is clearly unchecked, but reading it via inline JS value shows the value as 'on'. It's confusing and to create an example to show the problem is almost as difficult as solving the problem in the first place.

If someone has any examples of using js in "proper and approved" forms to gather data via AJAX, I would very much like to review same.

In any event, this is an uphill battle for me, but I'm making it.

Thanks for everyone's input -- I shall consider every comment and that will take time. Expect me to comment as I consider.

Paul -- as for the inline JavaScript -- in my opinion, whatever works first, works as an example for me to see how things happen. After which, I will try to make convert such code to be unobtrusive -- that's my goal. As for me, small steps first, larger steps will follow.

Thanks all!

tedd


_____________________
tedd at sperling.com
http://sperling.com


More information about the Javascript mailing list