i am using web3.js to communicate with my smart contract. how ever, when i try to submit the html form, and then use contract.deployed(), it isnt working below is the code.

<div id ="input" style="display: none; margin-left:50% ">
            <form id="stuff">
                <label for="Survey Number">Survey Number</label>
                <input id= "sno" type="text" placeholder="Enter survey Number" name="sno" required>
                <label for="dis">Choose a Disease:</label>
                <select id="disease" name="disease">
                  <option value="0">Fungal infection</option>
                  <option value="1">Allergy</option>
                  <option value="2">GERD</option>
                  <option value="3">Chronic cholestasis</option>
                  <option value="4">Drug Reaction</option>

                <button id = "registerbtn" type="submit" class="registerbtn" >Register</button>

js code

render: function() {
    $('#input').attr('style', 'margin-left:25%');
    $('#getCount').attr('style', 'display: none;');

    web3.eth.getCoinbase(function(err, account) {
      if (err === null) {
        App.account = account;
        $("#accountAddress").html("Your Account: " + account);

        App.contracts.Geriatric.deployed().then( function(instance){
          alert("insatnce "+instance);



The alert in the App.contracts.Geriatric.deployed() is not occurring,i cant seem to find what the real issue is.The App.contracts.Geriatric.deployed() works fine when not inside the submit event.

  • Try without all that HTML; Does it work? – goodvibration Jun 14 '20 at 16:25
  • the function works outside any of the html events.but when i try to call it after the form submission (even with only the textbox input field),it doesnt trigger the alert. – ChinnuJoseph Jun 14 '20 at 16:30
  • So it sounds to me like a pure JS/HTML problem, unrelated of Ethereum. – goodvibration Jun 14 '20 at 16:34
  • may be,but i cant seem to figure out what the problem is. I was looking for solutions from people who might have experienced this same thing during dapp development as well. i am relatively new in dapp development. – ChinnuJoseph Jun 14 '20 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.