Karl Swedberg wrote:
hmm. that doesn't sound right to me. I just put up a test page using jQuery 1.2.3, and it identified radio controls just fine:

http://test.learningjquery.com/123.html

Can we see the HTML? Maybe something else is going on.

<div id="job_template">
<fieldset>
<label for="jt_textfield" id="jt_textfield_label">Text</label>
<input type="text" name="jt_textfield" id="jt_textfield" size="30">
<br />
<input type="checkbox" name="jt_check1" id="jt_check1">This is checkbox 1
<br />
<input type="checkbox" name="jt_check2" id="jt_check2">This is checkbox 2
<br />
<label for="jt_textfield2" id="jt_textfield2_label">Second Text</label>
<input type="text" name="jt_textfield2" id="jt_textfield2" size="30">
</fieldset>
<table>
  <tbody>
    <tr>
      <td><input name="jt_dist_r_lo" value="NY" type="radio">NY</td>
      <td><input name="jt_dist_r_lo" value="OH" type="radio">OH</td>
      <td><input name="jt_dist_r_lo" value="PA" type="radio">PA</td>
    </tr>
  </tbody>
</table>
<textarea name="jt_textarea" id="jt_textarea" rows="2" cols="20">
</textarea>
</div>

Same problem with the textarea, by the way.

Here's the javascript... (note, this is from a genshi template - ${job.description} is a url string that encodes the names of the controls and their values, like so:

jt_textfield=this%20is%20text&jt_checkbox1=on&jt_dist_r_lo=OH&jt_textarea=this%20is%20a%20textarea


        var jt_values = "${job.description}";
        var els = jt_values.split('&amp;');
        $.each(els, function() {
            var items = this.split("=");
            var item = "#" + items[0];
            var item_val = decodeURIComponent(items[1]);

            switch ( $(item).attr('type') ) {
                case 'radio': alert(item + " is radio");
                    break;
                case 'checkbox': $(item).attr("checked","checked");
                    break;
                case 'text': $(item).val(item_val);
                    break;
                case 'textarea': $(item).val(item_val);
                    alert(item + " is textarea = " + item_val);
                    break;
                default:
                    alert(item+'unknown type:'+$(item).attr('type'));
                }

I'm getting undefined in the alert for unknown type on both jt_dist_r_lo
and jt_textarea

Reply via email to