Ticket #361 (reopened defect)

Opened 2 years ago

Last modified 2 years ago

When using WP-ContactForm the form does not display properly in IE, does with Firefox

Reported by: ic Assigned to: ryanduff
Priority: highest Component: wp-contact-form
Severity: critical Keywords:
Cc:

Description

On my blog at http://www.independentconservative.com/contact/ I use the WP-ContactForm? plug in for people to be able to send me feedback. In my Wordpress Admin area, when creating this page I did nothing but add the <!–contact form–> tag. When this page is viewed using FireFox? you can see the form properly. When viewing it with MS Internet Explorer the area where the form should be turns invisible and overlaps other areas on the page.

I cannot use the plugin with this issue, because of the high number of readers who use IE.

Change History

01/29/06 18:01:09 changed by ryanduff

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [4850]

02/04/06 00:29:25 changed by Teresa_Lo

I figured out how to do it - sort of.

Go to Plugins and click Plugin Editor. Under Plugin Files, click WP-ContactForm? to edit wp-contactform.php.

I basically took the "your website" line out, and whacked out all the lines associated with it, and now it looks OK in IE. Not perfect, but good enough. See it live in IE at http://splendidinvestor.com/contact-us

Compare your code to mine below. REMINDER: copy and save the original code in a txt file first before you fool around with it.

Good luck!

Teresa

<?php /* Plugin Name: WP-ContactForm? Plugin URI: http://ryanduff.net/projects/wp-contactform/ Description: WP Contact Form is a drop in form for users to contact you. It can be implemented on a page or a post. It currently works with WordPress 1.5+ Author: Ryan Duff Author URI: http://ryanduff.net Version: 1.4.2 */

load_plugin_textdomain('wpcf'); // NLS

/* Declare strings that change depending on input. This also resets them so errors clear on resubmission. */ $wpcf_strings = array(

'name' => '<div class="contactright"><input type="text" name="wpcf_your_name" id="wpcf_your_name" size="30" maxlength="50" value="' . $_POSTwpcf_your_name? . '" /> (required)</div>', 'email' => '<div class="contactright"><input type="text" name="wpcf_email" id="wpcf_email" size="30" maxlength="50" value="' . $_POSTwpcf_email? . '" /> (required)</div>', 'msg' => '<div class="contactright"><textarea name="wpcf_msg" id="wpcf_msg" cols="35" rows="8" >' . $_POSTwpcf_msg? . '</textarea></div>', 'error' => );

/* This shows the quicktag on the write pages Based off Buttonsnap Template http://redalt.com/downloads */ if(get_option('wpcf_show_quicktag') == true) {

include('buttonsnap.php');

add_action('init', 'wpcf_button_init'); add_action('marker_css', 'wpcf_marker_css');

function wpcf_button_init() {

$wpcf_button_url = buttonsnap_dirname(FILE) . '/wpcf_button.png';

buttonsnap_textbutton($wpcf_button_url, 'Insert Contact Form', '<!--contact form-->'); buttonsnap_register_marker('contact form', 'wpcf_marker');

}

function wpcf_marker_css() {

$wpcf_marker_url = buttonsnap_dirname(FILE) . '/wpcf_marker.gif'; echo "

.wpcf_marker {

display: block; height: 15px; width: 155px margin-top: 5px; background-image: url({$wpcf_marker_url}); background-repeat: no-repeat; background-position: center;

}

";

}

}

function wpcf_is_malicious($input) {

$is_malicious = false; $bad_inputs = array("\r", "\n", "mime-version", "content-type", "cc:", "to:"); foreach($bad_inputs as $bad_input) {

if(strpos(strtolower($input), strtolower($bad_input)) !== false) {

$is_malicious = true; break;

}

} return $is_malicious;

}

/* This function checks for errors on input and changes $wpcf_strings if there are any errors. Shortcircuits if there has not been a submission */ function wpcf_check_input() {

if(!(isset($_POSTwpcf_stage?))) {return false;} // Shortcircuit.

$_POSTwpcf_your_name? = stripslashes(trim($_POSTwpcf_your_name?)); $_POSTwpcf_email? = stripslashes(trim($_POSTwpcf_email?)); $_POSTwpcf_website? = stripslashes(trim($_POSTwpcf_website?)); $_POSTwpcf_msg? = stripslashes(trim($_POSTwpcf_msg?));

global $wpcf_strings; $ok = true;

if(empty($_POSTwpcf_your_name?)) {

$ok = false; $reason = 'empty'; $wpcf_stringsname? = '<div class="contactright"><input type="text" name="wpcf_your_name" id="wpcf_your_name" size="30" maxlength="50" value="' . $_POSTwpcf_your_name? . '" class="contacterror" /> (required)</div>';

}

if(!is_email($_POSTwpcf_email?)) {

$ok = false; $reason = 'empty'; $wpcf_stringsemail? = '<div class="contactright"><input type="text" name="wpcf_email" id="wpcf_email" size="30" maxlength="50" value="' . $_POSTwpcf_email? . '" class="contacterror" /> (required)</div>';

}

if(empty($_POSTwpcf_msg?)) {

$ok = false; $reason = 'empty'; $wpcf_stringsmsg? = '<div class="contactright"><textarea name="wpcf_msg" id="wpcf_message" cols="35" rows="8" class="contacterror">' . $_POSTwpcf_msg? . '</textarea></div>';

}

if(wpcf_is_malicious($_POSTwpcf_your_name?) wpcf_is_malicious($_POSTwpcf_email?)) {

$ok = false; $reason = 'malicious';

}

if($ok == true) {

return true;

} else {

if($reason == 'malicious') {

$wpcf_stringserror? = "<div style='font-weight: bold;'>You can not use any of the following in the Name or Email fields: a linebreak, or the phrases 'mime-version', 'content-type', 'cc:' or 'to:'.</div>";

} elseif($reason == 'empty') {

$wpcf_stringserror? = '<div style="font-weight: bold;">' . stripslashes(get_option('wpcf_error_msg')) . '</div>';

} return false;

}

}

/*Wrapper function which calls the form.*/ function wpcf_callback( $content ) {

global $wpcf_strings;

/* Run the input check. */

if(! preg_match('|<!--contact form-->|', $content)) { return $content; }

if(wpcf_check_input()) // If the input check returns true (ie. there has been a submission & input is ok) {

$recipient = get_option('wpcf_email'); $subject = get_option('wpcf_subject');

$success_msg = get_option('wpcf_success_msg'); $success_msg = stripslashes($success_msg);

$name = $_POSTwpcf_your_name?; $email = $_POSTwpcf_email?; $website = $_POSTwpcf_website?; $msg = $_POSTwpcf_msg?;

$headers = "MIME-Version: 1.0\n";

$headers .= "From: $name <$email>\n"; $headers .= "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";

$fullmsg = "$name wrote:\n"; $fullmsg .= wordwrap($msg, 80, "\n") . "\n\n"; $fullmsg .= "Website: " . $website . "\n"; $fullmsg .= "IP: " . getip();

mail($recipient, $subject, $fullmsg, $headers);

$results = '<div style="font-weight: bold;">' . $success_msg . '</div>'; echo $results;

} else // Else show the form. If there are errors the strings will have updated during running the inputcheck. {

$form = '<div class="contactform"> ' . $wpcf_stringserror? . '

<form action="' . get_permalink() . '" method="post">

<div class="contactleft"><label for="wpcf_your_name">' . ('Your Name: ', 'wpcf') . '</label></div>' . $wpcf_stringsname? . ' <div class="contactleft"><label for="wpcf_email">' . ('Your Email:', 'wpcf') . '</label></div>' . $wpcf_stringsemail? . ' <div class="contactleft"><label for="wpcf_website">' . ('Your Website:', 'wpcf') . '</label></div><div class="contactright"><input type="text" name="wpcf_website" id="wpcf_website" size="30" maxlength="100" value="' . $_POSTwpcf_website? . '" /></div>

<div class="contactleft"><label for="wpcf_msg">' . ('Your Message: ', 'wpcf') . '</label></div>' . $wpcf_stringsmsg? . ' <div class="contactright"><input type="submit" name="Submit" value="Submit" id="contactsubmit" /><input type="hidden" name="wpcf_stage" value="process" /></div>

</form>

</div> <div style="clear:both; height:1px;">&nbsp;</div>'; return str_replace('<!--contact form-->', $form, $content);

}

}

/*Can't use WP's function here, so lets use our own*/ function getip() {

if (isset($_SERVER)) {

if (isset($_SERVERHTTP_X_FORWARDED_FOR?)) {

$ip_addr = $_SERVERHTTP_X_FORWARDED_FOR?;

} elseif (isset($_SERVERHTTP_CLIENT_IP?)) {

$ip_addr = $_SERVERHTTP_CLIENT_IP?;

} else {

$ip_addr = $_SERVERREMOTE_ADDR?;

}

} else {

if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {

$ip_addr = getenv( 'HTTP_X_FORWARDED_FOR' );

} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {

$ip_addr = getenv( 'HTTP_CLIENT_IP' );

} else {

$ip_addr = getenv( 'REMOTE_ADDR' );

}

}

return $ip_addr; }

/*CSS Styling*/ function wpcf_css()

{ ?>

<style type="text/css" media="screen">

/* Begin Contact Form CSS */ .contactform {

position: static; overflow: hidden;

}

.contactleft {

width: 25%; text-align: right; clear: both; float: left; display: inline; padding: 4px; margin: 5px 0;

}

.contactright {

width: 70%; text-align: left; float: right; display: inline; padding: 4px; margin: 5px 0;

}

.contacterror {

border: 1px solid #ff0000;

} /* End Contact Form CSS */

</style>

<?php

}

function wpcf_add_options_page()

{

add_options_page('Contact Form Options', 'Contact Form', 'manage_options', 'wp-contact-form/options-contactform.php');

}

/* Action calls for all functions */

//if(get_option('wpcf_show_quicktag') == true) {add_action('admin_footer', 'wpcf_add_quicktag');}

add_action('admin_head', 'wpcf_add_options_page'); add_filter('wp_head', 'wpcf_css'); add_filter('the_content', 'wpcf_callback', 7);

?>

02/04/06 00:30:17 changed by Teresa_Lo

  • status changed from closed to reopened.
  • resolution deleted.

So, in any event, we still need some tips as to how to make it perfect for IE.

Thanks Ryan!