Custom form tag generate input names
-
I have put a javascript number spinner in my CF7-form and I’m trying to make a custom form tag for it so that input names would generate automatic like mvr1, mvr2, mvr3… because I have multiple number inputs/spinners in the same form. I just cant get the number to appear in the inputs name. It just shows <input type=”text” name=”mvr[]” class=”in-num czr-focusable” value=”1″ readonly=””> in every field. What am I doing wrong?
add_action( 'wpcf7_init', 'custom_add_form_tag_spin' ); function custom_add_form_tag_spin() { wpcf7_add_form_tag( 'spin', 'custom_spin_form_tag_handler', array( 'name-attr' => true )); } function custom_spin_form_tag_handler( $tag ){ return'<div class="num-block skin-7"> <div class="num-in"> <span class="minus dis">-</span> <input type="text" name="mvr[]" class="in-num" value="1" readonly="" <span class="plus">+</span> </div> </div>'; { $name = $_POST['mvr']; foreach( $name as $key => $n ) { print $n; } } }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom form tag generate input names’ is closed to new replies.