Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using v1.4.14 of the WPAlchemy MetaBox PHP Class. I have 2 select menus within a repeating group, available_from and available_to.

If I select Monday in the first select menu, Wednesday in the 2nd, and then save the post, the 2nd select menu's value changes to the first. So both become Monday. The initial values however are stored correctly in the DB upon the first save (Monday and Wednesday), but if you update the post again, they would be changed to Monday and Monday.

This happens when any day combination, but if I use the exact code below outside of the repeating group, it works as expected. I'm hoping someone has encountered this before and knows how to fix it. Really need the repeating group.

<?php while($mb->have_fields_and_multi('availability')): ?>
<?php $mb->the_group_open(); ?>

<label>Day (from)</label>
<?php $mb->the_field('available_from'); ?>
<select name="<?php $mb->the_name(); ?>" id="<?php $mb->the_name(); ?>">
    <option value="">Select Day</option>
    <option value="Monday"<?php $mb->the_select_state('Monday'); ?>>Monday</option>             
    <option value="Tuesday"<?php $mb->the_select_state('Tuesday'); ?>>Tuesday</option>
    <option value="Wednesday"<?php $mb->the_select_state('Wednesday'); ?>>Wednesday</option>
    <option value="Thursday"<?php $mb->the_select_state('Thursday'); ?>>Thursday</option>
    <option value="Friday"<?php $mb->the_select_state('Friday'); ?>>Friday</option>
    <option value="Saturday"<?php $mb->the_select_state('Saturday'); ?>>Saturday</option>
    <option value="Sunday"<?php $mb->the_select_state('Sunday'); ?>>Sunday</option>
</select>


<label>Day (to)</label>
<?php $mb->the_field('available_to'); ?>
<select name="<?php $mb->the_name(); ?>" id="<?php $mb->the_name(); ?>">
<option value="">Select Day</option>
<option value="Monday"<?php $mb->the_select_state('Monday'); ?>>Monday</option>             
<option value="Tuesday"<?php $mb->the_select_state('Tuesday'); ?>>Tuesday</option>
<option value="Wednesday"<?php $mb->the_select_state('Wednesday'); ?>>Wednesday</option>
<option value="Thursday"<?php $mb->the_select_state('Thursday'); ?>>Thursday</option>
<option value="Friday"<?php $mb->the_select_state('Friday'); ?>>Friday</option>
<option value="Saturday"<?php $mb->the_select_state('Saturday'); ?>>Saturday</option>
<option value="Sunday"<?php $mb->the_select_state('Sunday'); ?>>Sunday</option>
</select>

<div>
    <a href="#" class="dodelete">Remove</a>
</div>

<?php $mb->the_group_close(); ?>
<?php endwhile; ?>

<a href="#" class="docopy-availability button">Add new day range</a>
share|improve this question

1 Answer 1

up vote 1 down vote accepted

grab version v1.4.15

share|improve this answer
    
I could have sworn I checked github just in case you released a new version. Thanks so much Dimas, works great –  Andrew Sep 10 '11 at 0:03
1  
I released it after reading your post above ;-) –  farinspace Sep 11 '11 at 1:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.