WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Truncated html form data -- should I mess with data type in tables? (28 posts)

  1. jazzylee77
    Member
    Posted 3 years ago #

    When pasting something like this in the html field of post

    <form> <input style="border-color: rgb(85, 85, 85);" name="showImage1" class="showImageTextBox" onfocus="this.form.showImage1.select()" onclick="this.form.showImage1.select()" value="<a href=&quot;http://www.mysite.com/the-subject&quot;><img src=&quot;http://map.mysite.com/stash/image.gif&quot; border=&quot; 0 &quot; alt=&quot;The Subject&quot;></a><br /> onmouseover="this.style.borderColor='#FFC533'" onmouseout="this.style.borderColor='#555555'" size="20" type="text"></p>
    </form>

    instead it is pasted as

    <form><input class="showImageTextBox" style="border-color: #555555;" onclick="this.form.showImage1.select()" onmouseover="this.style.borderColor='#FFC533'" onmouseout="this.style.borderColor='#555555'" alt="&quot;New" name="showImage1" size="20" src="&quot;http://map.mysite.com/stash/image.gif&quot;" type="text" value="<a href=" />
    
    </form>

    basically truncating the guts of the form. I'm wondering if I should try messing with varchar setting in tables and which table?

  2. I think that you actually can't just paste the HTML for a form into a post (or page). You should use a form plugin, like TDO forms.

  3. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    I would not recommend that. It's just possible that you're hitting a problem with your host's server security. It might be worth having a word with them about it.

  4. jazzylee77
    Member
    Posted 3 years ago #

    Thanks to both. I'll check both clues out.

  5. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    I think that you actually can't just paste the HTML for a form into a post (or page).

    I disagree. What about PayPal forms or email subscription forms? I agree that the code for the above form wouldn't do a thing if it was untouched but the markup shouldn't be truncated by the HTML editor.

  6. jazzylee77
    Member
    Posted 3 years ago #

    One other thing. I am able to successfully post a similar form with shorter content. That's why I'm thinking it could be a character length issue.

  7. elfin
    Moderator
    Posted 3 years ago #

    are you using the Visual editor? if so try using the HTML one.

  8. jazzylee77
    Member
    Posted 3 years ago #

    This is just a form I sometimes use for sharing an image.

    Would be nice if some gallery included a way of photo sharing like this; where you could pull an image into a post with the form and visitors could click and copy html and bbc sharing codes as photobucket and others do.

  9. jazzylee77
    Member
    Posted 3 years ago #

    no, wasn't using visual editor. pasted in html editor

  10. Curtiss Grymala
    Member
    Posted 3 years ago #

    Are you only viewing it in HTML mode, or are you at some point switching over to the visual editor? Is it really pasting in differently than you copied it; or is it only changing after you save the post?

    I agree that the HTML editor should not be changing any of your code when you paste it in; but switching back to the visual editor for any reason will attempt to validate and sanitize your code; and saving the post will send it through various validation/sanitization functions, too.

    That said, there are multiple issues I see with the form code, though; and that might be why it's getting messed up the editor.

    1. Instead of using an <input>, you should probably be using a <textarea> (though this may or may not be having an effect)
    2. The HTML code you're using as the "value" attribute in the input is invalid. The editor is most likely trying to fix the invalid markup, which is resulting in the code being truncated.
    3. Finally, the opening and closing angle brackets ("<" & ">") should probably be encoded as & lt; and & gt; (with no spaces in either of those; but I can't figure out how to get this to stop unencoding the entities) when used inside the value attribute
  11. elfin
    Moderator
    Posted 3 years ago #

    In that case, deactivate all plugins, and change to twentyten theme and try again. If that fixes it, then reactivate one by one until a culprit is found.

    oh and who is your webhost?

  12. jazzylee77
    Member
    Posted 3 years ago #

    It literally pastes differently in the html editor.

    I do check it in the visual editor as well, but it truncates the code before I change views.

    this form works fine for the bbc code, though it doesn't need all that encoding for <> =

    <form> <input class="showImageTextBox" style="border-color: #555555;" onclick="this.form.showImage1.select()" onmouseover="this.style.borderColor='#FFC533'" onmouseout="this.style.borderColor='#555555'" name="showImage1" size="20" type="text" value="[URL=http://www.mysite.com/the-topic][IMG]http://www.mysite.com/stash/image.gif[/IMG][/URL]" />
    
    </form>

    Forms obviously aren't my strong suit. I just generated this bit of code from frontpage.

  13. jazzylee77
    Member
    Posted 3 years ago #

    host is site5

  14. Curtiss Grymala
    Member
    Posted 3 years ago #

    With your host being Site5, I can tell you with 99% certainty that this is not an issue with your server. I manage about 10 different WordPress websites on 5 different Site5 accounts, and cannot reproduce this problem.

    As Rich suggested, I would recommend deactivating all of your plugins and switching your theme to Twenty Ten temporarily to see if that stops the issue. If it does, then start putting things back the way they were one-by-one to see if you can figure out where the issue is popping up.

    Also, just in case it has any impact on the situation, what browser are you using?

  15. What about PayPal forms or email subscription forms?

    Maybe I should say 'Complicated forms'? Though maybe all my problems are mod_security related... I've never had it work right.

  16. jazzylee77
    Member
    Posted 3 years ago #

    okay, shutting down plugins and checking in 2010 theme... drag :)

    using firefox 3.6xxx

    I'll check it in IE before stripping it down.

  17. Curtiss Grymala
    Member
    Posted 3 years ago #

    Let us know how it goes with IE. Since you're using Firefox; I suddenly suspect that there may be a Firefox Add-on that's doing this to you. I've seen some very strange behavior occur with the WordPress HTML and Visual editors when using various add-ons in Firefox.

  18. jazzylee77
    Member
    Posted 3 years ago #

    A bit different behavior in IE. Sorta works in preview, (some unintended text is copied by the user -- onmouseover=...) but strips the url and beyond out of the value when switching to visual editor.

  19. elfin
    Moderator
    Posted 3 years ago #

    don't switch to the visual editor!

  20. Curtiss Grymala
    Member
    Posted 3 years ago #

    Switching to the visual editor will definitely change the code; as the visual editor is configured to strip non-sanitized code automatically. That is one of the downsides of TinyMCE (or most WYSIWYG editors for that matter).

    However, if the paste function is basically working in the HTML editor in Internet Explorer; I would strongly suspect the issue is tied to a specific Firefox Add-on rather than being related to WordPress itself.

  21. jazzylee77
    Member
    Posted 3 years ago #

    With all plugins deactivated it does not truncate immediately on pasting. But does when switching to visual editor.

    I'm close to giving up. Not a critical thing, but it would be nice, since a lot of the sites images are the type people like to share and can bring a link back with the right copy/paste form.

    I've looked at a lot of gallery plugins in vain looking for this feature

  22. jazzylee77
    Member
    Posted 3 years ago #

    Not sure I can handle the trade off of not using the visual editor. That would really slow me down, and I have hundreds of posts to make that use this.

  23. Curtiss Grymala
    Member
    Posted 3 years ago #

    Again, the visual editor will always strip out that type of code (unless you heavily modify the allowed elements in the WordPress implementation of TinyMCE), so switching to the visual editor will mess up that code no matter how many plugins you disable.

    If things are working in the HTML editor now, though, that's the best it's going to get. You'll just have to keep in mind that you can't use the visual editor for pages that include that code.

  24. elfin
    Moderator
    Posted 3 years ago #

    or better yet - create a shortcode and use that in the content, then you can use the Visual editor again.
    Shortcode API

  25. jazzylee77
    Member
    Posted 3 years ago #

    Okay, I'll probably sleep on it. Might be some other way to get there. Maybe insert from custom fields...

    Thanks all for the help.

  26. jazzylee77
    Member
    Posted 3 years ago #

    ah... haven't used shortcode before. Time to study up.

  27. jazzylee77
    Member
    Posted 3 years ago #

    Just thought I'd let you know, I found a nice workaround.

    Since the image and sharing code boxes appear at the top of every post where I use them, I added a custom field image-key and threw this in my themes Single Post (single.php)

    <?php get_custom_field_value('image-key', true);?>

    I have an excel page setup so I now just enter 3 fields -- the post slug, image filename, and alt. All the rest is in the worksheet and I copy from a concatenated field and paste into the posts custom field.

    Works like a charm.

    Thanks for the help again. Sometimes knowing what doesn't work is half the battle.

  28. Curtiss Grymala
    Member
    Posted 3 years ago #

    Perfect. Glad you were able to get it worked out.

Topic Closed

This topic has been closed to new replies.

About this Topic