Smiley Click picker using Javascript and FORM woes .. Please help...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • descds

    Smiley Click picker using Javascript and FORM woes .. Please help...

    OK im prety much a newbie at PHP but it has me hooked.

    Im writing a comment system for one of our modules on phpnuke. Its all
    going very well, well should i say WAS going very well :)

    Ok all the comments work etc and everything is intergrated nicely in the
    database. Now im parsing the comments back out to the user and replacing
    string like :) with emoticons etc. It works perfectly and i'm seriously
    pleased with myself (ok ok remember i said i was new at this :) .....

    Now the issue i have is a silly one. I want to present the form input
    for the comments in pretty much similair ways to phpbb does on a new
    post. I.e present BBCODE icons and smileys that can be clicked and it
    inserts into the FORM field ... I have a working javascript that does
    just that but try as i might the darn thing will NOT wrap a FORM (even
    if wrapping is on). This seems more a MOZILLA problem than IE ( wraps in
    that). So if i keep on hitting the same icon again and again it will not
    wrap and presents a scrollbar that keeps on going. The actual FORM will
    wrap if i insert text inside it manually however so maybe its a
    javascript error after all ??

    Anyway im hoping someone somewhere can shed some light on this. Here the
    test code.
    -----------------------------------------------------------------------------
    <html>
    <head>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <title></title>
    </head>
    <body>
    <script type="text/javascript">
    <!--
    function addsmiley(code)
    {
    var pretext = document.commen t.post.value;
    this.code = code;
    document.commen t.post.value = pretext + code;
    }
    //-->
    </script>
    <b>Comment on this movie:</b>
    <form name="comment" method="post" action="news.ph p"> <textarea
    name="post" wrap="hard" rows="8" cols="30"></textarea></form>
    <img src="../../forum/images/smiles/icon_biggrin.gi f" alt=":)"
    onclick="addsmi ley(':)')" style="border: 0px solid ; width: 15px;
    height: 15px; cursor: pointer;">
    </body>
    </html>
    ------------------------------------------------------------------------------
    Ive tried setting WRAP to Virtual / HARD / SOFT / Physical etc and it
    still insists on not wrapping from the javascript ... Anyone any ideas ???

Working...