The submit_button() function is flexible enough to handle resetting to defaults. :)<div><br></div><div>For example, here's my old code from Oenology (note that I pass a "tab" name to the button name attribute):</div>
<div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><input name="theme_oenology_options[submit-<?php echo $tab; ?>]" type="submit" class="button-primary" value="Save Settings" /></div>
<div><input name="theme_oenology_options[reset-<?php echo $tab; ?>]" type="submit" class="button-secondary" value="Reset Defaults" /></div></div></blockquote><div><br></div>
<div>And here's the replacement code:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><?php submit_button( __( 'Save Settings', 'oenology' ), 'primary', 'theme_oenology_options[submit-' . $tab . ']', false ); ?></div>
<div><?php submit_button( __( 'Reset Defaults', 'oenology' ), 'secondary', 'theme_oenology_options[reset-' . $tab . ']', false ); ?></div></div></blockquote><div><br></div><div>
The rendered output is exactly the same in both cases.</div><div><br></div><div>Assuming that your "reset defaults" functionality looks at the NAME attribute as part of the $_POST data passed to $input, then you're good to go.</div>
<div><br></div><div>Chip<br><br><div class="gmail_quote">On Mon, Jul 25, 2011 at 11:44 AM, George Mamadashvili <span dir="ltr"><<a href="mailto:georgemamadashvili@gmail.com">georgemamadashvili@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello Chip.<div><br></div><div>I noticed that function too and liked it, but if theme author what to provide "Reset to Default" button, does it still need to be hard-coded? I had no to dig in this function, can we this function for reset button too?</div>
<div><br></div><div>Best</div><div><br></div><div>George<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Mon, Jul 25, 2011 at 8:25 PM, Chip Bennett <span dir="ltr"><<a href="mailto:chip@chipbennett.net" target="_blank">chip@chipbennett.net</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">Good morning developers/reviewers!<div><br></div><div>Just a note, from something that I noticed being used in Twenty Eleven: the <a href="http://codex.wordpress.org/Function_Reference/submit_button" target="_blank">submit_button()</a> function, which replaces hard-coded form submit buttons.</div>
<div><br></div><div>I would strongly recommend making use of it in Theme Settings Page forms; as with other "doing things the core-supported way" criteria, I would expect this one to show up in the Guidelines at some point in the future.</div>
<div><br></div><font color="#888888"><div>Chip</div>
</font><br></div></div>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org" target="_blank">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
theme-reviewers mailing list<br>
<a href="mailto:theme-reviewers@lists.wordpress.org">theme-reviewers@lists.wordpress.org</a><br>
<a href="http://lists.wordpress.org/mailman/listinfo/theme-reviewers" target="_blank">http://lists.wordpress.org/mailman/listinfo/theme-reviewers</a><br>
<br></blockquote></div><br></div>