Number input in Modal - Failed to get mandatory argument: table

Game development with Board Game Arena Studio
Post Reply
User avatar
Crazyboog
Posts: 28
Joined: 30 April 2020, 22:12

Number input in Modal - Failed to get mandatory argument: table

Post by Crazyboog »

Hi,

I'm developing the texasholdem project and I have a weird error with a modal dialog.

I'm using a modal dialog with just a number input and two buttons (OK and Cancel) to allow to player to choose a bet amount. It works fine when using the buttons to confirm or cancel the bet, but when I click into the input area and press enter, it opens a page with the below content.

Untitled.png
Untitled.png (89.27 KiB) Viewed 816 times

Sorry, an unexpected error has occurred...

Failed to get mandatory argument: table

#0 /var/tournoi/release/tournoi-210121-0943-gs/www/include/APP_GameAction.inc.php(32): APP_Action->getArg('table', 1, true)
#1 /var/tournoi/release/tournoi-210121-0943-gs/www/include/APP_GameAction.inc.php(21): APP_GameAction->initGameTableObjects()
#2 /var/tournoi/release/tournoi-210121-0943-gs/www/include/webActionCore.inc.php(182): APP_GameAction->__construct()
#3 /var/tournoi/release/tournoi-210121-0943-gs/www/index.php(247): launchWebAction('texasholdem', 'action_texashol...', '__default', false, false, NULL, true, false)
#4 {main}

It seems it triggers a default action which does not contain the required argument. Any idea why that happenned?
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Number input in Modal - Failed to get mandatory argument: table

Post by Tisaac »

What does the modal code looks like ?
User avatar
Crazyboog
Posts: 28
Joined: 30 April 2020, 22:12

Re: Number input in Modal - Failed to get mandatory argument: table

Post by Crazyboog »

The modal code is shown below.

Code: Select all

// Create the new dialog over the play zone.
                this.raiseDlg = new ebg.popindialog();
                this.raiseDlg.create('chooseRaise');
                this.raiseDlg.setTitle(_("Choose Amount"));
                this.raiseDlg.setMaxWidth(500); // Optional

                var html = this.format_block('jstpl_choose_raise_dialog', {
                    INPUT_LABEL: _("Amount"),
                    RAISE_BUTTON_LABEL: _("OK"),
                    CANCEL_BUTTON_LABEL: _("Cancel")
                });  
                
                // Show the dialog
                this.raiseDlg.setContent(html);
                this.raiseDlg.show();
                

                dojo.connect($('raisebutton'), 'onclick', this, function(evt) {
                    var raiseAmount = $("raiseAmount").value;
                    this.raiseBy(raiseAmount);
                    evt.preventDefault();
                    this.raiseDlg.destroy();
                });

                dojo.connect($('cancelbutton'), 'onclick', this, function(evt) {
                    evt.preventDefault();
                    this.raiseDlg.destroy();
                });
and the

Code: Select all

jstpl_choose_raise_dialog
template is defined as follows:

Code: Select all

var jstpl_choose_raise_dialog = ' \
    <form> \
        <label for = "raiseAmount">${INPUT_LABEL}</label> \
        <input type = "number" id = "raiseAmount" value = 0><br> \
    </form> \
    <a type="button" class = "action-button bgabutton bgabutton_blue" id = "raisebutton">${RAISE_BUTTON_LABEL}</a> \
    <a type="button" class = "action-button bgabutton bgabutton_blue" id = "cancelbutton">${CANCEL_BUTTON_LABEL}</a> \
';
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: Number input in Modal - Failed to get mandatory argument: table

Post by Tisaac »

Just remove the form or connect the onsubmit event.
User avatar
Crazyboog
Posts: 28
Joined: 30 April 2020, 22:12

Re: Number input in Modal - Failed to get mandatory argument: table

Post by Crazyboog »

Thanks for the tip, that did the trick. I don't understand why with the form it causing this error though.
Post Reply

Return to “Developers”