Get updates

HTML

Scott Learn to Program with JavaScript Series: An HTML Beginner’s Interactive Tutorial

I’m a web developer by day and have been programming, in one language or another, most of my life since age 10. But for someone without consistent (or any) programming experience, how do you learn to program? This question was brought on by a friend of mine who had a programming class or two years ago and is now setting his sights on giving it another shot.

The good news is that you don’t have to be a life-long programmer to have some fun with it. Old, young, students, hobbyists, and non-programmer professionals can all learn to program, provided they have some interest and a little time (it doesn’t take much to get started).

Continue Reading…

Scott Q&A: How to Set a Form’s ID in Rails?

HTML is not hard. Anyone who can program, in any language, should be able to write HTML with little or no training. Yet there are reasons why the HTML helper functions in Rails can be handy. Chief among them is the easy and fairly clean way you can incorporate variables and other constructs; after all, the idea here is to have an app generate some of the code rather than having to write every piece by hand.

I was happily marching to the tune of form_tag() when I decided that I wanted a little JavaScript function to interact with the form’s contents. Great, except the HTML form code being generated by that helper function wasn’t coming with its own id attribute.

I could probably have the JavaScript function refer to this particular form by indexing an array, but then it could break if I ever changed the layout of the page to include another form. Hardly ideal.

Question: How does one tell Rails what the form’s id should be when creating the form with the helper function (or the Ajax form_remote_tag)?

Continue Reading…

3DM Design is where Scott Drake publishes thoughts on programming web applications in JavaScript and Ruby.