Web Design, Graphic Design, and open source software! I love GIMP, Blender and InkScape (as well as a few others). I hope to make tutorials and show you the ropes so you can make beautiful web pages.
Tuesday, November 17, 2009
Friday, November 13, 2009
Railo Coldfusion
December, looks like I will use Railo for it.
Thursday, November 12, 2009
Sun Virtual Box
tonight with VirtualBox (http://www.virtualbox.org)
Friday, November 6, 2009
Wine and Adobe
worth it to ditch Windows full-time?
Tuesday, November 3, 2009
Friday, October 30, 2009
Simple Modal and Mu for Facebook Connect
Modal Window library out (
http://www.ericmmartin.com/simplemodal-1-3-3-released/ ), and Mu (
http://mu.daaku.org/ ) is great for adding FaceBook Connect to any web
page. Finally you can add a modal window that can allow a user to
sign into Facebook from a blog and manage their friends...
What an amazing world!
Wednesday, October 14, 2009
JQuery dependent form field validation
the days when I'd write my own form validation or other such heavy JS
code. 99% of the time JQuery is amazing, but that last 1% is when you
have pushed too hard and are in a corner with a deadline approaching..
Such is the case with a recent project. I had a form which had
several fields on it. To help "Joe User" (when "User" means "Pothead"
or other such lower form of life), we changed the page from two forms
which beautifully inserted data into separate tables to one monster
form that submitted data to a controller which decided which data went
into which table.
There was the equivalent of shipping address information on the top
and items to be shipped on the bottom. The address information might
be updated separate from the shipping data on the bottom. The problem
is that the bottom part of the form would be blank, which the
controller can handle (if blank, don't insert it -duh). The problem
is that in validation, a shipping item might need to have a item
number and price but making them required would trigger a validation
problem when just hitting submit after changing the address.
So I needed the required shipping item information to be required when
filled in, but ignored otherwise. The trick is to use the "rules"
block inside the form.validate() statement, and add a function that
returns true or false to set or unset the fields to be required. I
finally found the answer in the JQuery Docs (
http://docs.jquery.com/Plugins/Validation/Methods/required#dependency-expression
). I did the copy-paste-alter thing and violah! It didn't work...
WHY! Hours had turned to days on this one issue.. and it still would not work!
Ok, I calmed down and found out the following is IMPORTANT:
- Name and ID synchronization: Do yourself a favor and keep the form
inputs' names and IDs the same. The $("#name") is obviously the ID
but less obvious, the rules block in the Validate method point to the
input's NAME. Keep them the same and life is good.
- JavaScript form submission: It is what the cool kids are doing, but
it can interfere with the form validation. When the regular submit
button was pressed the form validated and would error properly. When
the JavaScript based link was used the form would error but submit
anyhow. Not great because that allowed bad data to be inserted into
the database.
So, I wish you all good luck and hopefully you will read this and say
"pft, I am no idiot, I knew that" but you have that luxury at this
point, I would have said the same thing (as I took note of this
advice).
Popular Posts
-
So, you are a hard working nerd and have a windows computer to manage routers with. You also have a lot to do and would rather automate som...
-
WOW, reason 9,746 to move to Linux. My parents have a laptop with Vista on it. Not a big deal, should do normal stuff and not require much...
-
This applies, in my case, to a Virtualbox VM running Backtrack 5r2. I have a network I inherited. It has been a source of pain that few ...