views:

348

answers:

1

hello All,

I am new to the programming world of dojo and web applications. I am trying to acomplish a task where I want to manipulate the textbox value with some text. I tried everything including some code from dojocampus, but even this code doesnot do anything. I have also tried to create an instance , with dojo.widget.byId and dijit.byId and then tried the instance.value = 'newtext' and everything that I could find but for some reason , the textbox is not updating. Please help me.

<html>
<head>
<title>Dojo example</title>
<style type="text/css">
  @import "pathtodojo/dijit/themes/nihilo/nihilo.css";
</style>
<style type="text/css">
</style>
<script type="text/javascript" src="pathtodojo/dojo/dojo.js" djConfig="parseOnLoad:true, isDebug: true"></script>
<script>


  dojo.require("dijit.form.TextBox");

  function init() {
    var box0 = dijit.byId("value0Box");
    var box1 = dijit.byId("value1Box");
    box1.attr("value", box0.attr("value") + " modified");
    dojo.connect(box0, "onChange", function(){
    box1.attr("value", box0.attr("value") + " modified");
    });
  }

  dojo.addOnLoad(init);

</script>

<body class="nihilo">
A textbox with a value: <input id="value0Box" dojoType="dijit.form.TextBox" value="Some value" intermediateChanges="true"></input>
<br>
A textbox set with a value from the above textbox: <input id="value1Box" dojoType="dijit.form.TextBox"></input>
<br>
</body>
</html>

regards C

A: 

thanks everyone. It worked for me. I am using Aptana editor and for some reason inspite of specifying the location of DOJO , it never got me the results. I then moved the dojo folder to root and now it works. thanks everyone for your help.