Viewed   112 times

This is what I got:

<form action="invoiceCreate.php" method="post">
<input type="checkbox" name="business" id="business" vaulue="yes" />

Basically when I check the "business" checkbox, I want the form action to change to BusinessInoiveCreate.php instead of InvoiceCreate.php.

What would be the best way to do so?

 Answers

2
$('#business').on('change', function(){
    if ($(this).is(':checked')) {
        $('form').attr('action', 'BusinessInoiveCreate.php');
    } else {
        $('form').attr('action', 'invoiceCreate.php');
    }
});

Working demo: http://jsfiddle.net/eV7vY/

Wednesday, August 17, 2022
 
2

This HTML:

echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNoz.'<br />'.$postz.' at '.$timez.' seconds mark</p><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNoz.'"</input></div>';

should be:

echo '<div id="post1"><p class="postParagraph">Post ID No.'.$idNoz.'<br />'.$postz.' at '.$timez.' seconds mark</p><input type="checkbox" name="checkbox[]" id="checkbox[]" value="'.$idNoz.'" /></div>';

This query on else if($_POST['btnDelete'] == "Delete") should be:

$sql = 'DELETE FROM `'.$tbl_name.'` WHERE `PostID`='.(int)$value;
Friday, September 2, 2022
 
vassie
 
4
$(":checkbox").click(function(){
    var options="";
    $(":checkbox:checked").each(function(){
        options += $(this).val()+";"; 
    });

    $("input[name='modelos']").val(options);
});

Online demo: http://jsfiddle.net/ZPxqJ/6/

Monday, December 12, 2022
 
4
$("#selectsearch").change(function() {
  var action = $(this).val() == "people" ? "user" : "content";
  $("#search-form").attr("action", "/search/" + action);
});
Tuesday, November 29, 2022
 
2

Add a class to your checkboxes, remove the obtrusive onclick and use jQuery to fire the form submit unobtrusively.

<%= t.check_box :provider_completed, 
  { :checked => task_assigned.provider_completed, 
  {:class => 'checkable'} } %>

$('.checkable').live('change', 
function() {
    $(this).parents('form:first').submit();
});
Saturday, December 24, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :