Solidity - “Uncaught TypeError: Cannot read property 'contract' of undefined”

steveeq1steveeq1 Member Posts: 5
I am somewhat new to the Mix IDE and ethereum (solidity specifically) and I have a naive question. How does the javascript code in my web page get "tied" to the contract code? I wrote a simple web page that takes in a value, but the javascript can't seem to pass the value to the actual contract. The exact error line is:

var result = contracts["MyFirstContract"].contract.reportUser("foo");

The exact error Mix is giving me is:
"Uncaught TypeError: Cannot read property 'contract' of undefined."
So it apparently sees contracts["MyFirstContract"] as nil

However, the MyFirstContract.sol file exists! How does the javascript know what contract file I am talking about? It doesn't seem to appear in the documentation, although I may be missing something.

Comments

Sign In or Register to comment.