x
 
Create New Page
 View Previous Changes    ( Last updated by mahalie )

Stand Alone Notepad

In the tradition of various stand-alone forms (user registration, entry form, edit form, etc) here is my quick & dirty take on a stand-alone notepad. You know, the one every member gets in his control panel, but I wanted to embed into a regular template. Here’s me code:

<html>
<
head>
        $(
document).ready(function() {
            
$('#notepad').ajaxForm(function() {
                alert(
"Notepad updated.");
            
});
        
});
     
</
head>
<
body>

<?php global $SESS; ?>

{exp
:query sql="SELECT notepad, notepad_size FROM exp_members
WHERE member_id = '<?=$SESS->userdata['member_id'];?>'"
}
<form id="notepad" method="post" action="{path=member/update_notepad}">
   <
input type="hidden" name="notepad_size" value="{notepad_size}" />
   <
textarea name="notepad" rows="{notepad_size}" cols="120">{notepad}</textarea>
   <
input type="submit" value="Update" />
</
form>
{/exp:query}
</body></html>

It uses PHP parsed on Input, jquery and the form plugin to update the field dynamically. This thread has a little more info.

Category:CodingCategory:HacksCategory:HowTo

Categories: