Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get a form to pop up on the same page when user clicks a profile link. I have put a div by the form. And that div id in the js code, and in the css.

What I have tried:

I have tried putting a div around the form, and placed the javascript code in the custom css and js plugin. I put the js and css there.

<form action="/process_page.php" class="form container">
<div class="John_Form" id="JohnForm">
<li><label for="Fname">First Name</label><br><input id="first_name" name="first_name" type="text" required=""></li>
<li><label for="Lname">Last Name</label><br><input id="last_name" name="last_name" type="text" required=""></li>
<li><label for="email">Email</label><br>
<input id="mail" name="email" type="email" required=""><br>
<label for="Jquestion">John<br>Ask John a question</label><input id="JohnQuestion" name="JohnQuestion" type="text"></li>
<p><iframe src="webyardcraft2.local/johns-profile"></iframe></p>
</div>
</form>


function div_show() {
  document.getElementId('JohnForm')
  style.document="block";
}

function div_hide() {
  document.getElementId('JohnForm')
  style.document="none";
  
}


#John_Form {
  display: none;
  position: fixed;
  bottom: 0;
  right: 15px;
  border: 3px solid #f1f1f1;
  z-index: 9;
}

.form-container {
  max-width: 300px;
  padding: 10px;
  background-color: white;
}


#John_Form {
  display: none;
  position: fixed;
  bottom: 0;
  right: 15px;
  border: 3px solid #f1f1f1;
  z-index: 9;
}


<a href="http://webyardcraft2.local/johns-profile/">John<br> Ask a question</a>
Posted
Updated 18-Feb-22 4:39am

1 solution

You need to use the "show" or "hide" functions, see the code below as an example -

>
$(function() {
    $("#popupContainer").dxPopup({
        title: "Popup Title",
        contentTemplate: function () {
            return $("<p />").text("Popup content");
        }
    });
    $("#showButton").dxButton({
        text: "Show the Popup", 
        onClick: function () {
            $("#popupContainer").dxPopup("show");
            // === or ===
            $("#popupContainer").dxPopup("toggle", true);
        } 
    });
    $("#hideButton").dxButton({
        text: "Hide the Popup", 
        onClick: function () {
            $("#popupContainer").dxPopup("hide");
            // === or ===
            $("#popupContainer").dxPopup("toggle", false);
        } 
    });
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900