logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

This is an old version of this question!

Return to the current question

$17
Dynamically Add More Fields To Form (Theme Options)

I have a theme options page, this one, and I have multiple fields for a single item/row with a mix of select and text fields. My issue is I'm trying to have an add more and delete item buttons so that I can just add more instantly. See my image example. Any ideas how to make it work with my code below?

		case 'filmcredit':	
$film_stored = $val;

$output .= '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][filmyear]' ) . '" id="' . esc_attr( $value['id'] . '_filmyear' ) . '">';
for ($i = 2011; $i > 1949; $i--) {
$filmyear = $i;
$output .= '<option value="' . esc_attr( $filmyear ) . '" ' . selected( $film_stored['filmyear'], $filmyear, false ) . '>' . esc_html( $filmyear ) . '</option>';
}
$output .= '</select>';
$theroles_array = array("" => "Role","Actor/Actress" => "Actor/Actress","Reality Participant" => "Reality Participant","Dancer" => "Dancer","Model" => "Model","Singer" => "Singer");
$output .= '<select class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . '][filmrole]' ) . '" id="' . esc_attr( $value['id'] . '_filmrole' ) . '">';
foreach ($theroles_array as $key => $theroles ) {
$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $film_stored['filmrole'], $key, false ) . '>'. $theroles .'</option>';
}
$output .= '</select>';
$output .= '<input id="' . esc_attr( $value['id'] . '_filmproduction' ) . '" class="of-input" name="' . esc_attr( $option_name . '[' . $value['id'] . '][filmproduction]' ) . '" type="text" value="' . esc_attr( $film_stored['filmproduction']) . '" />';

break;

attachment image View Attachment

Jon Stephen | 12/07/11 at 5:23pm

This is an old version of this question!

Return to the current question