I'm sending a transaction to a contract from Javascript through web3. The transaction is created. The solidity function is (partially) executed because it sends the token it's expected to send... but, values are no stored in a mapping.
I tested with browser-solidity and it works. I tested with https://www.myetherwallet.com and it works. In both cases, I can retrieve the values of the mapping. But when I do through javascript, it doesn't work.
Here is the code of javascript calling function:
scheduleAppointment : function(_patient, _doctor, _appointmentDateTime) {
var patientAddress = document.getElementById("patientInput");
var doctorAddress = document.getElementById("doctorInput");
var appointmentDateTime = document.getElementById("timeStampInput");
contractInstance.scheduleAppointment.sendTransaction(patientAddress.value,
doctorAddress.value,
appointmentDateTime.value,
{gas:140000, from:web3.eth.accounts[0]});
}
Here is the code of solidity function (this function does not send tokens, only stores to mapping):
function scheduleAppointment(address _patient, address _doctor, uint _appointmentDateTime) {
appointmentsList[_patient][_doctor][_appointmentDateTime].appointmentStatus = 1;
}
As you see, it would be impossible to make it more simple.. but it doesn't work. Transaction is created, but the value is not stored in the mapping.
Should I convert parameters before sending them from javascript? I couldn't find any reference for sending many parameters with sendTransaction
. I've tried converting the integer value with parseInt
when calling the function with javascript, but it's the same.
Any ideas? Thanks.