Forum Moderators: open
function initShowHide () {
jQuery('#slickbox').hide(); // hide form on page load jQuery('a#slick-toggle').click(function() { // make "submit" button show and hide on click
jQuery('#slickbox').toggle(400);
return false;
}); jQuery(form).submit(function() { // make form stay open if submitted
jQuery('#slickbox').show();
return false;
});
};
1) I have the form wrapped in a div. the *div* is what's showing and hiding - not the form itself. Would it be better (and most likely work) if I make the *form* show hide, rather than the div that encompasses it?
2) Would it work if I put in an extra hidden field that passes a value, and if the value is set, then the form stays open? (and if so - I have *no clue* how to write that!)
//the form stuff has been validated in the php before here...
//with $showTheForm (Boolean -php variable) representing whether or not you want to show the form div..
<script type="text/javascript">
var showForm = <?php echo ($showTheForm) ? 'true' : 'false'; ?>;
</script>
function initShowHide () {
if (!showForm) {
jQuery('#slickbox').hide(); // hide form on page load
}