Sending authoriztion code to confirm account

Need help. Having trouble with Hyperbytes tutorial at the registration form section using PHP. Have completed up to sending authorization code upon submitting the form I am getting a 500 error: http://localhost:3000/dmxConnect/api/registration/register.php 500 serverconnectForm.js:280 can I get help with this? Thanks, j

1 Like

Hello @webdesignBCMS
Check this tutorial and share the info with us:

Thanks for your reply. code reads: 1. {code: 0, file: "/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/dmxConnect.php", line: 133,…}

  1. code: 0
  2. file: "/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/dmxConnect.php"
  3. line: 133
  4. message: "Option "value" is required!"
  5. trace: "#0 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/modules/core.php(135): option_require(Object(stdClass), 'value')\n#1 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(223): modules\core->setvalue(Object(stdClass), 'mycode', Array)\n#2 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(195): lib\App->execSteps(Object(stdClass))\n#3 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(163): lib\App->execSteps(Array)\n#4 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(152): lib\App->exec(Object(stdClass), false)\n#5 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(113): lib\App->exec(Object(stdClass), false)\n#6 /Users/altec2/Documents/coding/cnylocal/www/dmxConnect/api/registration/register.php(7): lib\App->define(Object(stdClass))\n#7 {main}"

Seems like option"value" is required!" is the problem how do i interpert that error?

under "Response" error reads:
{
"code": 0,
"file": "/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/dmxConnect.php",
"line": 133,
"message": "Option "value" is required!",
"trace": "#0 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/modules/core.php(135): option_require(Object(stdClass), 'value')\n#1 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(223): modules\core->setvalue(Object(stdClass), 'mycode', Array)\n#2 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(195): lib\App->execSteps(Object(stdClass))\n#3 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(163): lib\App->execSteps(Array)\n#4 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(152): lib\App->exec(Object(stdClass), false)\n#5 /Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php(113): lib\App->exec(Object(stdClass), false)\n#6 /Users/altec2/Documents/coding/cnylocal/www/dmxConnect/api/registration/register.php(7): lib\App->define(Object(stdClass))\n#7 {main}"
}
similar message here - I don't know how to interpert either . Can you help ? Thanks again.

Too late here, but as far as I can see:
You have a set value action named mycode that doesn't have a value yet.
Server action runs one action after other, so repeat can't be executed because mycode (previous one) is blank.

Delete that one and try again:

HI Thanks for your help. I figured out the problem and although it did look like mycode being blank was the problem it wasn't. The Set Value mycode = {{g_mycode+randomarray[$_index]}} had not entered correctly in the set value properties. Everything is working now. Thanks much for your help!

Well i was wrong. mycode = {{g_mycode+randomarray[$_index]}} should have been mycode = {{g_mycode+randomarray[$index]}}, But that didn't work either.
The email was sent , but the 6 dig code was blank. This is the tutorial from Brian English and I followed the code exactly. When i debugged got this:
Deprecated: lib\App::parse(): Implicitly marking parameter $scope as nullable is deprecated, the explicit nullable type must be used instead in /
has the PHP code been updated ? I went through this tutorial using Node.js and didn't have any trouble - received no errors.

rest of code reads:

<br/><b>Deprecated</b>:  lib\App::parse(): Implicitly marking parameter $scope as nullable is deprecated, the explicit nullable type must be used instead in <b>/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php</b> on line <b>244</b><br/><br/><b>Deprecated</b>:  lib\App::parseObject(): Implicitly marking parameter $scope as nullable is deprecated, the explicit nullable type must be used instead in <b>/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php</b> on line <b>248</b><br/><br/><b>Deprecated</b>:  lib\App::parseTemplate(): Implicitly marking parameter $scope as nullable is deprecated, the explicit nullable type must be used instead in <b>/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/App.php</b> on line <b>287</b><br/><br/><b>Deprecated</b>:  lib\core\Scope::__construct(): Implicitly marking parameter $parent as nullable is deprecated, the explicit nullable type must be used instead in <b>/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/core/Scope.php</b> on line <b>11</b><br/><br/><b>Deprecated</b>:  lib\core\Parser::parse(): Implicitly marking parameter $scope as nullable is deprecated, the explicit nullable type must be used instead in <b>/Users/altec2/Documents/coding/cnylocal/www/dmxConnectLib/lib/core/Parser.php</b> on line <b>100</b><br/>{
    "code": 0,
    "file": "\/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnectLib\/dmxConnect.php",
    "line": 133,
    "message": "Option \"value\" is required!",
    "trace": "#0 \/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnectLib\/modules\/core.php(135): option_require(Object(stdClass), 'value')\n#1 \/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnectLib\/lib\/App.php(223): modules\\core->setvalue(Object(stdClass), 'mycode', Array)\n#2 \/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnectLib\/lib\/App.php(195): lib\\App->execSteps(Object(stdClass))\n#3 \/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnectLib\/lib\/App.php(163): lib\\App->execSteps(Array)\n#4 \/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnectLib\/lib\/App.php(152): lib\\App->exec(Object(stdClass), false)\n#5 \/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnectLib\/lib\/App.php(113): lib\\App->exec(Object(stdClass), false)\n#6 \/Users\/altec2\/Documents\/coding\/cnylocal\/www\/dmxConnect\/api\/registration\/register.php(7): lib\\App->define(Object(stdClass))\n#7 {main}"
}

really need help resolving this. Thanks!

Have you deleted the empty mycode?

When i do delte it the code sent back in the email is: Your auth code is:{[g_mycode]}

Do you think code in the tutorial is wrong?

Brian English states in the tutorial that mycode is blank.

Add the set mycode (g_mycode) value in and set its value to ' ' (a space character)

When you use it in the email, use g_mycode.trim() to remove any spaces. That satisfies the Set Value requiring a value

Alternatively set the mycode (g_mycode) to {{null}} (instead of just empty)

What is the purpose of these steps especially the empty mycode step and the repeat step, what is the expected result here?

I really don't think so, but, maybe we should tag him @Hyperbytes

I think it is initialising a variable with a global name (because the repeat will have variables in its own scope) to empty, then adds a new random character each iteration of the repeat to the global name of the variable

But wouldn't this be enough to generate a random 6 digit code from the random array?

randomarray.join('', '').substr(0, 6)

Screenshot 2025-03-06 at 17.05.28

1 Like

@Teodor from what I see, he's reproducing this:

or

randomarray.top(6).join('','')

lots of ways to skin a cat...

I think the repeat was used as a more visual (and possibly more 'native Wappler') method for those learning Wappler

1 Like

accoding to the tutorial mycode is supposed to be a blank variable, the Repeat 6 iterates through the randomarray array 6 times and adds the number of digits to the code. Then next step redefines g_mycode and adds the randomarray $index 6 digit code out put to server action. Best as i can explain it -- it is in the tutorial at:https://www.youtube.com/watch?v=MxP_7Ph1Cew&list=PLUjqTJN3byC9W9UFjsV9f9vefe_ZSFQfb&index=14

And by the way I did the same tutorial in Nod.js and didn't have any trouble with the code.

Just use the example i provided. It does not need a repeat and the end result is the same. The set value step requires a value.