You need to have the Web Personalization App to implement this case.
Here is an explanation how you can add a Marketo Form into a Web Personalization (RTP) dialog campaign. When the web visitor completes the form, a thank you message is shown and the campaign disappears.
NOTE: The Form sometimes may not appear in the Preview Campaign option. You can preview it as a Sandbox Preview campaign to test it. (See here.)
Additional Resources on this topic: