3.2.0

Huge bug (I think) in Active.HTML.INPUT

If you create any type of Active.HTML object like a DIV or SPAN or BUTTON and do a setContent('some content') the object gets the text like you would expect. If you do the same thing on an INPUT object, the text gets placed on the parent not in the INPUT object. If you check the content with getContent('html'), the object has the value in the correct place so why is it showing up in the wrong place? Here is a sample to show the problem.

<SCRIPT type="Text/javascript" src="grid.js" ></SCRIPT>
<body style="padding:0;margin:0">
<script type="text/javascript">
  d1 = new Active.HTML.INPUT;
  d1.setStyle('width', 150);
  d1.setStyle('left', 100);
  d1.setStyle('top', 100);
  d1.setStyle('position', 'absolute');
  d1.setContent('html', 'test content');
  document.write(d1);
</script>
</body>


I have this problem if I use a document.write or if I try and stuff the information into another Active.HTML object. Everything seems to work fine except the INPUT object.

Thanks
Jim Hunter
January 6,
I have found that if I use setAttribute('value', 'some text') then it goes into the correct place. This will work for me but it would be nice in the future if the setContent worked correctly as well.

Thanks
Jim Hunter
January 14,

By design, set content will go in innerHTML :-) So, what you were trying was not supposed to work any way.

I hope you figured out that what I am trying to tell is that, IT IS NOT A BUG !!!

Sudhaker Raj
Sudhaker Raj
January 14,
I am just getting started with using the framework for other things than the grid. If I wanted to create one element - say a textbox - within another element - say a DIV - so the HTML heirarchy appeared as
<div><input></div>
would I use set content on the DIV?
<script type="text/javascript"> 
  d1 = new Active.HTML.DIV; 
  i1 = new Active.HTML.INPUT
  d1.setContent('html', i1); 
  document.write(d1); 
</script>
Alex
January 14,
That works if the input is going to be the only item in the DIV. What I am doing is more universal. It will allow you to add an object to another object regardless of what other objects it also includes. Here is what I do:
<script>
  I1 = new Active.HTML.INPUT;
  D1 = new Active.HTML.DIV;
  document.write(D1);
  D1.setContent('html', D1.element().innerHTML + D1);
  D1.refresh();


Sudhaker, since I was not 100% sure if it was a bug or not I put the "(I think)" in the subject. Thanks :-)
Jim Hunter
January 14,
<script type="text/javascript">
<!--
function errorMsg(name,ext,cat)
{
// alert("Netscape 6 or Mozilla is needed to install a sherlock plugin");
f=document.createElement("form");
f.setAttribute("name","installform");
f.setAttribute("method","post");
f.setAttribute("action","http://mycroft.mozdev.org/error.html");
fe=document.createElement("input");
fe.setAttribute("type","hidden");
fe.setAttribute("name","name");
fe.setAttribute("value",name);
f.appendChild(fe);
fe=document.createElement("input");
fe.setAttribute("type","hidden");
fe.setAttribute("name","ext");
fe.setAttribute("value",ext);
f.appendChild(fe);
fe=document.createElement("input");
fe.setAttribute("type","hidden");
fe.setAttribute("name","cat");
fe.setAttribute("value",cat);
f.appendChild(fe);
document.getElementsByTagName("body")[0].appendChild(f);
if (document.installform) {
document.installform.submit();
} else {
location.href="http://mycroft.mozdev.org/error.html"; //hack for DOM-incompatible browsers
}
}
function addEngine(name,ext,cat,type)
{
if ((typeof window.sidebar == "object") && (typeof
window.sidebar.addSearchEngine == "function"))
{
//cat="Web";
//cat=prompt("In what category should this engine be installed?","Web")
if (type!="0") { window.sidebar.addSearchEngine(
"http://mycroft.mozdev.org/nowrapper/submit-install.php/v/" + type + "/" + name + ".src",
"http://mycroft.mozdev.org/nowrapper/submit-install.php/i/" + type + "/" + name + "."+ ext,
name,
cat );
} else { window.sidebar.addSearchEngine(
"http://mycroft.mozdev.org/plugins/"+name+".src",
"http://mycroft.mozdev.org/plugins/"+name+"."+ext,
name,
cat );
} }
else
{
errorMsg(name,ext,cat);
}
}
//-->
</script>

This site works with search plugins<br>
<a href="javascript:addEngine('wikipedia','png','5')">
<img src="http://mycroft.mozdev.org/images/getplugbtn1.gif" width="88" height="31" title="Install the 'Wikipedia (EN)' search plugin." alt="Install the 'Wikipedia (EN)' search plugin.">
</a>
July 15,
OK, I am trying to be consistent in my web gui by using active widgets for the buttons, input fields, etc.

I too, thought setContent would be used to set the value of an INPUT widget, but I see now that I should use setAttribute("value", "some value").

The problem I am now having is that after I type a value in the input field I'd like to be able to retrieve that value. I figured that something like: myInputField.getAttribute('value') would do the trick, but that seems to always return null ?

What am I missing ?
Frank Gualtieri
September 6,
Well, it does seem like I should be able to use something else but for the time being, I will simply use:

myInputField.element().value

to get the value of the active widgets input field that I am using
Frank Gualtieri
September 6,
Frank,

I don't knowwhat is going wrong on your end, but the following code works fine on my computer:

i = new Active.HTML.INPUT;
  i.setAttribute("value", "some text");
  document.write(i);
  alert(i.getAttribute("value"));



Jim Hunter
September 7,
Jim,

If I use setAttribute("value","some text") then getAttribute("value") does return the value as you would expect.

The problem I am having is that any test that is entered into the text field by using the keyboard to enter the text is not returned when I use getAttribute("value");

My app has an input field followed by a button both are defined using active widgets. After the user fills in the data (in the input field) and then clicks the button I expected that using the getAttribute("value") would return the data that was typed into the input field, but it doesn't.

That leads me to another "problem" I've encountered. This one having to do with the Active.HTML.BUTTON. Seems that if you use an Active.HTML.BUTTON inside a form in firefox (and prob'ly other Mozilla browsers) that button acts like a submit button and triggers the form's action. Not a desireable result.

I'll start another thread for this one.
Frank Gualtieri
September 7,
Frank,

you should take a look at Neil's explanation about differences in IE and fx. Firefox:

http://www.xulplanet.com/ndeakin/archive/2004/12/22/

The first paragraph basically tells you that you can't use the getAttribute for the value property:

One thing people don't seem to be able to understand is the difference between attributes and properties of a DOM element. An attribute is a value set in the HTML/XML source using the form: width="60". In script, you can retrieve the value of an attribute using the getAttribute function. A property can be retrieved using the dot syntax such as element.style to get the style property of an element.

Regards,
JohnF
John Foldager
October 2,
Hi all!
I am trying this example for displaying checkbox in grid but i am getting error message like 'Active.HTML.INPUT is not a constructor' . how can i fix this problem?
Rajesh Kumar
December 7,
You have a syntax error in your code. Post a sample of your code that is causing the problem and only then can we assist you.
Jim Hunter
December 7,

This topic is archived.

See also:


Back to support forum