Skip to content
Advertisement

Error: invalid string value (arg=”_name”, coderType=”string”, value=null)

I am trying to parse a persons information from a UI to a smart contract, the problem I seem to be having is the example I followed parses int’s and I’m not sure what to change in order to parse strings across? This code is just trying to get the player name and birthday.

Here is my smart contract code:

JavaScript

And my code for my UI:

JavaScript

When I deploy this to a local host using http-server in visual studio code I get this error: enter image description here

Is there a parse string code that has to be used? Or have I just missed a line of code somewhere?

Advertisement

Answer

In your submit function – you are casting your “name” and “birthday” fields to an integer (where solidity is expecting a string).

Try removing the parseInt function.

JavaScript

to

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement