Home > Back-end >  Bootstrap form data not submitting when in modal
Bootstrap form data not submitting when in modal

Time:01-05

I have the following form:

enter image description here

<form action="../util/vcput.php" method="POST">
    <input name="vockey" type="hidden" value="<?php echo getCsrfToken(); ?>">
    <input name="a" value="addorgadmin" type="hidden">
    <input name="m" value="editorg" type="hidden">
    <input name="q1" value="orgid=<?php echo $org->id; ?>&orgadmins=1" type="hidden">
    <input type="hidden" name="orgid" value="<?php echo $org->id; ?>">
    <div >
        <div >
            <div >
                <input  type="text" placeholder="Email" id="userEmail" name="userEmail" aria-label="New Admin Email"></input>
            </div>
            <div >
                <input  type="text" placeholder="Name" id="userName" name="userName" aria-label="New Admin Name"></input>
            </div>
            <div >
                <!-- <button type="submit" >Add admin</button> -->
            </div>
        </div>
    </div>
    <button type="submit" >Add admin</button>
</form>

However, when clicking the submit button nothing happens, no data is submitted/no action is taken. I know that the name/id values are correct, as the lines are copied over from an older version of the page (modified to bootstrap v5).

Am I doing something wrong here? The form is in in a modal-body and doesn't work, but works when outside.

EDIT: Figured it out... I had a form tag enclosing the entire page that I had forgotten about, so having this form nested was breaking functionality. Oops.

CodePudding user response:

Figured it out... I had a form tag enclosing the entire page that I had forgotten about, so having this form nested was breaking functionality. Oops.

  •  Tags:  
  • Related