Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 898601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:04:18+00:00 2026-05-15T15:04:18+00:00

I’ve got a webpage that validates as XHTML 1.0 Strict. I’m using YUI3 and

  • 0

I’ve got a webpage that validates as XHTML 1.0 Strict. I’m using YUI3 and I’m using the seed-file-based instantiation. In several places in my javascript code, I’m doing something like:

YUI().use("node", function(Y){
  var node = Y.one("#my_element_id");
});

It works great, cross-platform, cross-browser, etc. in almost every case. However, I was testing yesterday, and I came across one time it didn’t work. It made no sense to me, the element I was trying to grab was:

<form id="component_form" method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
...
</form>

I know for sure it is well-formed markup, so that’s not the issue. If I do:

YUI().use("node", function(Y){
  var node1 = Y.one("#component_form");
  var node2 = document.getElementById("component_form");
  var node3 = Y.one(document.getElementById("component_form"));
});

node1 is null, and node2 is the element I was looking for, and so is node3.

Anyone have a similar experience, or know if this is a YUI3 bug, or what?

Here is a full markup example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
    <!-- metadata -->
    <title>Inventory Management System</title>      
    <script type="text/javascript" src="http://yui.yahooapis.com/3.1.1/build/yui/yui-min.js"></script>
    <script src="./util.js" type="text/javascript"></script>    
    <style type="text/css">
      td{
        vertical-align:text-top;
      }  

      legend{
        border: 2px #D4D0C8 groove;
        padding: 2px;       
        font-weight: bolder; 
      }

      fieldset{
        border: 2px #D4D0C8 groove;
        padding-bottom: 12px;              
        padding-left: 10px;
        padding-right: 10px;
      }

      label{
        font-weight: bold;
      }

      #err_container{
        color: red;
        display: none;
        visibility: hidden;
        margin: 10px;
      }

      #status_container{
        color: green;
        display: none;
        visibility: hidden;
        margin: 10px;
      }      
    </style>

  </head>
  <body>
    <div id="canvas">
      <form id="st_frm" method="post" action="" style="display:none; visibility: hidden;">        
        <fieldset style="border:none; margin:0; padding:0;">          
          <input type="hidden" name="state" id="st" value=""/>            
        </fieldset>
      </form>

      <div id="navbar">
              <a href="#" onclick="goToState(0); return false;">home</a> 
       | components |         <a href="#" onclick="goToState(2); return false;">products</a> 
            </div>


              <h1 id="main_h1">

            Update Component
                  </h1>
        <form id="component_form" method="post" action="/inventory/index.php">
          <fieldset>            
            <legend id="component_form_legend">Component Information</legend>
            <input type="hidden" id="component_form_id" name="id" value="8"/>
            <input type="hidden" name="state" value="1"/>
            <table>

              <tr>
                <td><label for="manufacturer_name_id">Manufacturer:</label></td>
                <td><input type="text" id="manufacturer_name_id" name="manufacturer_name" value="Vishay"/></td>
              </tr>
              <tr>
                <td><label for="manufacturer_part_number_id">Part Number:</label></td>
                <td><input type="text" id="manufacturer_part_number_id" name="manufacturer_part_number" value="1123114123"/></td>
              </tr>

              <tr>
                <td><label for="ct_id">Component Type:</label></td>
                <td>
                  <select id="ct_id" name="component_type">
                    <option value="0">New Type</option>                    
                                        <option value="5" >sfkd</option>
                                        <option value="6" >qwrqew</option>

                                        <option value="7"  selected="selected" >Resistor</option>

                  </select>
                  <input id="nct_id" type="text" name="new_component_type" size="10"  style="visibility:hidden; display: none;" />
                </td>
              </tr>
              <tr>
                <td><label for="description_id">Description:</label></td>
                <td>

                  <textarea id="description_id" name="description" rows="3" cols="25">limits the flow of current...</textarea>
                </td>
              </tr>
              <tr>
                <td>&nbsp;</td>                                  
                <td>
                                    <input id="component_form_submit_button" type="button" value="Update Component"/>
                  <span id="component_form_hide_when_new" >
                    <input id="component_form_delete_button" type="button" value="Delete Component"/>

                    <input id="component_form_new_button"    type="button" value="New Component"/>
                  </span>                  
                  <input id="component_form_delete" name="delete" type="hidden" value="0"/>
                </td>
              </tr>
              <tr>
                <td colspan="2">
                  <div id="error_container">&nbsp;</div>
                  <div id="status_container">&nbsp;</div>                  
                </td>

              </tr>
            </table>
          </fieldset>
        </form>

        <ul id="component_form_list">        
          <li>
            <a href="#" onclick="setNodeValue('component_form_id', 8); submitForm('component_form'); return false;">Vishay 1123114123</a>
          </li>

        </ul>        


    </div>

  </body>
</html>

EDIT
IE 8 crashes on the var s = … line because frm is null.

function submitForm(frmId){
  YUI().use("node", function(Y){
    var frm = Y.one("#" + frmId);    
    var s = typeof frm.submit;
    if(s === 'function'){
      frm.submit();
    }
  });    
}

but….

function submitForm(frmId){
  YUI().use("node", function(Y){
    var frm = Y.one(document.getElementById(frmId));    
    var s = typeof frm.submit;
    if(s === 'function'){
      frm.submit();
    }
  });    
}

works in both…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:04:19+00:00Added an answer on May 15, 2026 at 3:04 pm

    Did you miss one double quote?

    <form id="component_form" method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
    

    …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.