php - adding form validation jquery causes previous jquery submit function not to work -
i have form stops behaving expected when add form validation jquery.
<form class="myform" action="booking.php?token=<?php echo time(); ?>" method="get" name="f<?php echo ( $row['vehicle_id'] );?>" class="request_submit"> <input type="hidden" name="v_id" value="<?php echo ( $row['vehicle_id'] );?>" /> <input type="hidden" name="p_id" value="<?php echo $params['quote_location']['pickup']['location_id']; ?>" /> <input type="hidden" name="p_val" value="<?php echo $params['quote_location']['pickup']['location_name']; ?>" /> <input type="hidden" name="d_id" value="<?php echo $params['quote_location']['dropp']['location_id']; ?>" /> <input type="hidden" name="d_val" value="<?php echo $params['quote_location']['dropp']['location_name']; ?>" /> <?php if ( $row['vehicle_price_mode'] == 'fixed' ): $v_price = $row['vehicle_price'] ; else: $v_price = ( $params['quote_price'] * $row['vehicle_price'] ) / 100 ; endif; ?> <div style="padding:15px;"> <table style="width:200px;border:0px solid black"> <tr> <td align="right"> <div class="quoteradio"> <label><input name="q_price" type="radio" checked="checked" value="oneway|<?php echo swd_number_format( ( $params['quote_price'] + $v_price )); ?>"> 1 way: £<?php echo ( swd_number_format( $params['quote_price'] + $v_price ) ); ?></label> </div> </td> </tr> <tr> <td align="right"> <div class="quoteradio"> <label><input name="q_price" type="radio" value="twoway|<?php echo swd_number_format( ( $params['quote_price'] + $v_price ) * 2 ); ?>"> 2 way: £<?php echo swd_number_format( ( $params['quote_price'] + $v_price ) * 2 ) ; ?></label> </div> </td> </tr> <tr> <td align="right"> <button type="submit" class="btn btn-primary">reserve </button></td> </tr> </table> </div>
which linked submit action
$(".myform").submit(function(e){ var targeted_popup_class = "popup-1"; $('[data-popup="' + targeted_popup_class + '"]').fadein(350); e.preventdefault(); var vehicle_id = $(this).parent().find('input[type="hidden"][name="v_id"]').val(); $('input[name="vehicle_id"]').val(vehicle_id); var pickup_id = $(this).parent().find('input[type="hidden"][name="p_id"]').val(); $('input[name="pickup_id"]').val(pickup_id); var pickup_name = $(this).parent().find('input[type="hidden"][name="p_val"]').val(); $('input[name="pickup_name"]').val(pickup_name); var dest_id = $(this).parent().find('input[type="hidden"][name="d_id"]').val(); $('input[name="dest_id"]').val(dest_id); var dest_name = $(this).parent().find('input[type="hidden"][name="d_val"]').val(); $('input[name="dest_name"]').val(dest_name); var quote_price = $(this).parent().find('input[type="radio"][name="q_price"]:checked').val(); $('input[name="quote_price"]').val(quote_price); });
but when try include form validationon same page different form initial submit jquery stops behaving expected
just adding jquery tax above previous jquery stops functioning expected
$("form[name='registration']").validate({ } });
. please advise why , how can solve this.
thanks
Comments
Post a Comment