Have a Default Value in Text Box

Home Forums WPAlchemy Have a Default Value in Text Box

This topic contains 1 reply, has 2 voices, and was last updated by  Dimas 1 year ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2589

    sullivandavid
    Participant

    I have a group of fields for slider slides. For one of the text boxes I would like to have a Default Value like “Learn More” appear in the meta text box so the user can keep that value or change it to something else.

    I have tried these two variations with no luck; it just puts whatever the current value is-blank or not:

    <input type=”text” name=”<?php $mb->the_name(); ?>” value=”<?php ($mb->the_value() ? $mb->the_value() : ‘Learn More’); ?>”/>

    and

    <input type=”text” name=”<?php $mb->the_name(); ?>” value=”<?php ($mb->the_value()<>” ? $mb->the_value() : ‘Learn More’); ?>”/>

    #2590

    Dimas
    Key Master

    using “the_value” vs “get_the_value” will output (echo) the value, you can try the following:

    < ?php $mb->get_the_value() ? $mb->the_value() : “Learn More” ; ?>

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.