MailChimp-Widget
MailChimp-Widget copied to clipboard
Poor HTML Markup
Currently your markup is outputting as seen below
<form method="post" id="ns_widget_mailchimp_form-3" action="/dev/">
<label>First Name :<input type="text" name="ns_widget_mailchimp_first_name"></label>
<br>
<label>Email Address :</label><input type="hidden" value="3" name="ns_mc_number"><input type="text" name="ns_widget_mailchimp_email">
<input type="submit" value="" name="Enter" class="button">
</form>
This makes no sense. The first input as the label wrapping the label and the input and the second input just has the label around the text. And then you have the hidden input before the actual email input.
Can you at least code them with some sort of structure so I don't have hack and edit the plugin everytime I update?
<form method="post" id="ns_widget_mailchimp_form-3" action="/dev/">
<p><label for="ns_widget_mailchimp_first_name_3">First Name :</label><input type="text" name="ns_widget_mailchimp_first_name" id="ns_widget_mailchimp_first_name_3"></p>
<p><label for="ns_widget_mailchimp_email_3">Email Address :</label><input type="text" name="ns_widget_mailchimp_email" id="ns_widget_mailchimp_email_3"></p>
<p><input type="submit" value="" name="Enter" class="button"><input type="hidden" value="3" name="ns_mc_number"></p>
</form>
This makes a lot more sense, is somewhat structurally semantic and makes for styling and adding JS to it much easier.
Thanks for the feedback... I'll look into it as soon as I find the time.
Cheers,
James
On Thu, Jul 7, 2011 at 12:06 PM, goodknight < [email protected]>wrote:
Currently your markup is outputting as seen below
<form method="post" id="ns_widget_mailchimp_form-3" action="/dev/"> <label>First Name :<input type="text" name="ns_widget_mailchimp_first_name"></label> <br> <label>Email Address :</label><input type="hidden" value="3" name="ns_mc_number"><input type="text" name="ns_widget_mailchimp_email"> <input type="submit" value="" name="Enter" class="button"> </form>
This makes no sense. The first input as the label wrapping the label and the input and the second input just has the label around the text. And then you have the hidden input before the actual email input.
Can you at least code them with some sort of structure so I don't have hack and edit the plugin everytime I update?
<form method="post" id="ns_widget_mailchimp_form-3" action="/dev/"> <p><label>First Name :</label><input type="text" name="ns_widget_mailchimp_first_name"></p> <p><label>Email Address :</label><input type="text" name="ns_widget_mailchimp_email"></p> <p><input type="submit" value="" name="Enter" class="button"><input type="hidden" value="3" name="ns_mc_number"></p> </form>
This makes a lot more sense, is somewhat structurally semantic and makes for styling and adding JS to it much easier.
Reply to this email directly or view it on GitHub: https://github.com/kalchas/MailChimp-Widget/issues/9
Hey Kalchas, Just re-read my first post and it comes off like I'm attacking you. I apologize for the tone of that post.
File: mailchimp-widget/lib/ns_widget_mailchimp.class.php
$collect_first = '';
if ($instance['collect_first']) {
$collect_first = '<p><label>' . __('First Name :', 'mailchimp-widget') . '</label><input type="text" name="' . $this->id_base . '_first_name" /></p>';
}
$collect_last = '';
if ($instance['collect_last']) {
$collect_last = '<p><label>' . __('Last Name :', 'mailchimp-widget') . '</label><input type="text" name="' . $this->id_base . '_last_name" /></p>';
}
$widget .= '<form action="' . $_SERVER['REQUEST_URI'] . '" id="' . $this->id_base . '_form-' . $this->number . '" method="post">' . $this->subscribe_errors . $collect_first . $collect_last . '<p><label>' . __('Email Address :', 'mailchimp-widget') . '</label><input type="text" name="' . $this->id_base . '_email" /></p><p><input class="button" type="submit" name="' . __($instance['signup_text'], 'mailchimp-widget') . '" value="' . __($instance['signup_text'], 'mailchimp-widget') . '" /><input type="hidden" name="ns_mc_number" value="' . $this->number . '" /></p></form><script type="text/javascript"> jQuery(\'#' . $this->id_base . '_form-' . $this->number . '\').ns_mc_widget({"url" : "' . $_SERVER['PHP_SELF'] . '", "cookie_id" : "'. $this->id_base . '-' . $this->number . '", "cookie_value" : "' . $this->hash_mailing_list_id() . '", "loader_graphic" : "' . $this->default_loader_graphic . '"}); </script>';
This gets close to what I was referring to.
No worries, sir... Just checking emails mid-workday. My recollection is that I decided against paragraph breaks because I was trying to get a minimalism that may just not be possible. The bad nesting is a straight up error, that I'll definitely fix. And apologies if my tone was at all defensive (wasn't intended to be) :) I'll have a look at your proposed code when I get a minute.
J.
On Thu, Jul 7, 2011 at 1:06 PM, goodknight < [email protected]>wrote:
Hey Kalchas, Just re-read my first post and it comes off like I'm attacking you. I apologize for the tone of that post.
File: mailchimp-widget/lib/ns_widget_mailchimp.class.php
$collect_first = ''; if ($instance['collect_first']) { $collect_first = '<p><label>' . __('First Name :', 'mailchimp-widget') . '</label><input type="text" name="' . $this->id_base . '_first_name" /></p>'; } $collect_last = ''; if ($instance['collect_last']) { $collect_last = '<p><label>' . __('Last Name :', 'mailchimp-widget') . '</label><input type="text" name="' . $this->id_base . '_last_name" /></p>'; } $widget .= '<form action="' . $_SERVER['REQUEST_URI'] . '" id="' . $this->id_base . '_form-' . $this->number . '" method="post">' . $this->subscribe_errors . $collect_first . $collect_last . '<p><label>' . __('Email Address :', 'mailchimp-widget') . '</label><input type="text" name="' . $this->id_base . '_email" /></p><p><input class="button" type="submit" name="' . __($instance['signup_text'], 'mailchimp-widget') . '" value="' . __($instance['signup_text'], 'mailchimp-widget') . '" /><input type="hidden" name="ns_mc_number" value="' . $this->number . '" /></p></form><script type="text/javascript"> jQuery(\'#' . $this->id_base . '_form-' . $this->number . '\').ns_mc_widget({"url" : "' . $_SERVER['PHP_SELF'] . '", "cookie_id" : "'. $this->id_base . '-' . $this->number . '", "cookie_value" : "' . $this->hash_mailing_list_id() . '", "loader_graphic" : "' . $this->default_loader_graphic . '"}); </script>';
This gets close to what I was referring to.
Reply to this email directly or view it on GitHub: https://github.com/kalchas/MailChimp-Widget/issues/9#issuecomment-1525768
Quite the contrary, your response was much nicer than mine would have been. :-) Other than the nesting issues, I've been really happy with the plugin. Good job!!