ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Values in Comment Form

July 13, 2010 4:41pm

Subscribe [3]
  • #1 / Jul 13, 2010 4:41pm

    Neo Mudaly

    90 posts

    First off, congratulations on the new EE site - sweet work guys!

    I’m having a bit of a problem with setting values to my comment form URL input and textarea.

    I’m using jQuery to hide labels on focus. My labels are set as input values and hide when a user focuses on the input.

    My problem is the default value for the {url} field input overrides the value I set in the template and always remains as “http://”

    I’m experiencing the same issue with my comment textarea although in this case I get no value at all. The textarea remains empty when I set the value to “Comment Here”.

    How do I resolve this - I’d hate to change the entire design because it works for all other inputs.

    Thanks,
    Neo

  • #2 / Jul 13, 2010 8:44pm

    Brandon Jones

    5500 posts

    Neo, to clarify, if you temporarily remove the jQuery do the input fields submit as expected?

  • #3 / Jul 13, 2010 10:35pm

    Neo Mudaly

    90 posts

    Hi Brandon,

    The comment submits just fine and I’ve tried disabling the jQuery - no luck.

    The actual problem is that the labels don’t display as expected on my URL and Comment input fields. The labels are supposed to display within the input fields.


    PLEASE NOTE: I made a mistake above. I’m actually setting the labels using the “title” attribute NOT ‘value’.


    For the URL field I get the default “http://” label - I’m guessing because my value=”{url}”  ??
    The label for my comment textarea doesn’t show up at all.


    The site is live and you can see the behaviour here by scrolling down to the comments:
    http://desyna.com/blog/building-desyna


    I’m using the same code for my footer contact form and that appears to work fine.

  • #4 / Jul 14, 2010 4:53pm

    Ingmar

    29245 posts

    Can you show us the code for your comment form?

  • #5 / Jul 14, 2010 5:08pm

    Neo Mudaly

    90 posts

    Here you go: 😏

    {exp:comment:form preview="{template_group}/index" disable="categories|pagination|trackbacks"}
                
                {if logged_out}
                <div id="makeCommentName">
                    <input type="text" id="name" name="name" value="{name}" title="Name (*required)" class="comment-field fieldFocus" size="50" />
                </div>
                <div id="makeCommentEmail">
                    <input type="text" id="from" name="email" title="Email (*required)" value="{email}" class="comment-field fieldFocus" size="50"/>
                </div>
                <div id="makeCommentUrl"> 
                    <input type="text" id="website" name="url" title="Website (*optional)" value="{url}" class="comment-field fieldFocus" size="50"/>
                </div>
                <div id="comment-remember-info" class="comment-field">
                    <input class="comment-checkbox" type="checkbox" name="save_info" value="yes" {save_info} />
                    Remember my personal information
                </div>
                {/if}
    
                <div id="makeCommentComment">
                    <textarea title="Comment Here (*required)" class="comment-field fieldFocus" name="comment" cols="1" rows="1">{comment}</textarea>
                </div>
                
                <div class="comment-field inputBtn">
                    <input class="cta-button" id="sendComment" type="submit" name="submit" value="Submit"/>
                </div>
    
    {/exp:comment:form}
  • #6 / Jul 15, 2010 3:13pm

    Ingmar

    29245 posts

    If you want to have your fields pre-filled, as it were, you need specify that value= attribute. Try this:

    <input type="text" id="website" name="url" value="Website" />
    <textarea name="comment" cols="1" rows="1">Comment Here</textarea>
  • #7 / Jul 16, 2010 12:15pm

    Neo Mudaly

    90 posts

    Thanks Ingmar,

    I just worked it out - for some reason my ‘pre-filling’ with EE tags was causing some complications.

    Thanks for your help - case solved. 😊

    Neo

  • #8 / Jul 16, 2010 7:13pm

    Brandon Jones

    5500 posts

    Glad you’re up and running, Neo!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases