Topic: WYSIWYG and html forms
I am trying to use the WYSIWYG plug-in to enhance my forms, but am coming up short.
If I apply the class to a textarea I do not get the WYSIWYG displaying. If I use the syntax from the doc (<div class="wysiwyg" data-mdb-wysiwyg="wysiwyg">
) then the contents do not get posted or getted when the form is submitted.
I have seen a post (https://mdbootstrap.com/snippets/standard/m-duszak/3256156#js-tab-view) that suggests what to do, but it is somewhat above my head. If I have a form with multiple fields and want to also include a WYSIWIG field, and have it submit via $_POST or $_GET can you provide an example? It might be that you could just flesh out the snippet from the previously mentioned example.
To be clear let's say the form looked like this:
<form action = "MYPROCESSPROGRAM.PHP">
Title:
<textarea name="title" cols="60" rows="2"><?php echo $Story->title; ?></textarea>
<div class="first-area">
<div class="wysiwyg" data-mdb-wysiwyg="wysiwyg">
</div>
</div>
<button type="submit" class="btn btn-primary">
Submit
</button>
</form>
And now I want to get the data from the Submit so I can post it into a MYSQL table. Normally I would use $_POST to get the data. How do I get it here?
Grzegorz Bujański staff answered 3 years ago
I understand that in this case, the problem is the lack of the name
attribute for the textarea
? You can add it with JS: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/3786279#js-tab-view
IAA_73 pro premium priority answered 3 years ago
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.11.0
- Device: pc
- Browser: edge
- OS: win 10
- Provided sample code: No
- Provided link: Yes