This topic contains 1 reply, has 2 voices, and was last updated by Sean Sean 3 years, 3 months ago.

$_POST variable not sent if using ENTER Key.


  • lleflon
    Participant

    Posts: 28
    Member Reply #1255

    To come back on my comment http://themeforest.net 9923636
    $_POST variable not sent if using ENTER Key.

    http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469/comments?page=223#comment_9923636

    Your first idea was good, use INPUT HIDDEN
    But it works well only if we have only one SUBMIT button.
    If like me, you must have several buttons SUBMIT
    For example UPDATE and DELETE
    Variable management quickly becomes a hell, especially if on the same page, you have several possible actions.

    The cleanest and easiest solution to implement is to prohibit the ENTER key in the forms on the desired fields.
    The solution that I use
    Add the bottom of the page

    
    <script LANGUAGE="JavaScript">
    <!--
    function refuserToucheEntree(event)
    {
        // Compatibilité IE / Firefox
        if(!event && window.event) {
            event = window.event;
        }
        // IE
        if(event.keyCode == 13) {
            event.returnValue = false;
            event.cancelBubble = true;
        }
        // DOM
        if(event.which == 13) {
            event.preventDefault();
            event.stopPropagation();
        }
    }
    // -->
    </script>
    

    In INPUT : onkeypress=”refuserToucheEntree(event);”

    
    <input class="form-control form-control-solid placeholder-no-fix" type="text" autocomplete="on" placeholder="carousel_news_description" name="carousel_news_description" value="<? echo $carousel_news_description; ?>" onkeypress="refuserToucheEntree(event);"/>
    

    Maybe you could integrate this type of feature in future updates?
    Best regards
    And thank you for your help on this topic
    If my solution can help someone else

    • This topic was modified 3 years, 4 months ago by  lleflon.
    Sean
    Sean
    Keymaster

    Posts: 4527
    Support Staff Reply #1339

    Hi :),

    Looks good. Sure, we will consider using your solution in a future releases.

    Thanks.

You must be logged in to reply to this topic.