Jquery Tutorial: Select or deselect a radio button

Comment 1 Standard

Today was the first time I tried to do this and believe it or not many of the tutorials/examples I found on good ole Google didn’t work. So after about 45 minutes I finally found an example that worked for me. Hopefully you won’t spend as long looking for the answer as I did.

//select the radio button

//deselect the radio button

Reference:  Comment posted by JoaoLuiz at the bottom

MySQL Tutorial: Put table column schema enum values in an array

Leave a comment Standard

I hate hard coding enums so you can use this script to get the enum values directly from the table schema. That way if you add or change them you don’t have to go update all of your hard coded nonsense.

$table = "your_table_name";
$field = "field_in_your_tablename";
$sql = "SHOW COLUMNS FROM {$table}";
 $result = mysql_query($sql)
 or die (mysql_error());
 while ($row = mysql_fetch_row($result))
     if ($row['Field'] == $field)
           $values = $row['Type'];
 //remove the formatting around the values
 $enum_array = explode("','", substr($values, 6, strlen($values)-8));
 //here are the enum items on your table

DOJO Grid FIX: row header or column data not showing up

Leave a comment Standard

Okay so I officially am not fond of DOJO, haha. If you’re having trouble getting your results to show up I’ve found that’s is probably one of three different things:

  1. Syntax error in your javascript, also check your grid layout and make sure you have a comma after each cell’s formatting information except for the last one
  2. There is some other CSS that’s changing the position of the grid data… so you get rows in the table but the information is off to one extreme side of the screen. Usually I find I have this problem if I’m trying to align the parent div that’s around the child grid divs.
  3. DOJO tries to expand the grid to the size of the parent div. That means if your parent div doesn’t have a size set it’s possible it won’t show up. Also DOJO does better if the div has a fixed with in em/px rather than a percentage.

jQuery Tutorial: Toggle enabled/disabled attribute for multiple radio buttons

Leave a comment Standard

So today I spent 10 minutes thinking about how to write something in jQuery that would go through and toggle the disable status for a group of radio buttons that have been dynamically generated and then it suddenly hit me — duh, just add a class to all of them and toggle based on the class. So I hope this code prevents you from having the same “brain fart” moment I did.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script language="Javascript">

$(document).ready(function() {
 /* they've entered/removed something into my input field, toggle the radio buttons */
 $("#myInputValue").keyup( function() { toggleDisableFields($('#myInputValue').val())});

function toggleDisabledRadioButtons(value)
 /* check to see if they've entered a value in the field you want to toggle against */
 if (value) {
 /* the radio buttons shouldn't be disabled yet */
 else {
     <input type="text" id="myInputValue" /><br/>
     Enter something to disable my radio buttons, clear it out to use them again
     Radio One: <input type="radio" name="myoption" class="radioButtonClass" value="1" /><br/>
     Radio Two: <input type="radio" name="myoption" class="radioButtonClass" value="2" /><br/>
     Radio Three: <input type="radio" name="myoption" class="radioButtonClass" value="3" /><br/>
     Radio Exception: <input type="radio" name="myoption" value="4" /><br/>
     (leave off the class and it won't toggle with the rest)

$30,000 in prizes for your Flash games

Comment 1 Standard

Adobe and FGL Present: Cell Your Game Contest

Maybe you’ve heard the news: the newest Android mobile OS fully supports Flash. Guess what that means? Now’s the time to break into a brand new market for Flash games! Adobe and FGL are proud to host a very special contest exclusively for members of FGL. Create or port a game for mobile Flash platforms and you could win fabulous prizes — not to mention open a whole new world of players and profit. There are over $30,000 in cash and prizes and 150 games will win at least $100. Go on, check it out!

To say that we are excited about this new Flash game market would be a huge understatement. We’ve created a new forum full of guides, FAQs, and support to help you take advantage of this new frontier. Adobe is providing us with the latest guidelines, APIs, and tools, and we’ll make them available to you here.

It’s not every day that you get a chance to get in on the ground floor of a new audience for your games. And you may already have a bunch of great games that fit the mobile platform. You can back-port your catalog, or you can create new games that take advantage of the special features of Android phones, such as the accelerometer and touchscreen.

You’ve got nothing to lose and tons of money to gain. Come on!