0
function GenerateTermSheet()
        {
            var urlString = "<%= System.Web.VirtualPathUtility.ToAbsolute("~/mvc/Indications.cfc/RenderPartialTermSheetView/")%>"
            $("#termSheetPopup checkbox:checked").each(function(){
                alert("Clicked");
                var json = 
                {
                    id : GetGUIDValue(),
                    name : $(this).attr("name")
                }
                $.ajax({
                    type: "POST",
                    url: urlString,
                    data: json,
                    success: function(data) {

                    }
                });

            })
        }

I never see that alert appear. If I put it on every line above where it is, it appears, so I know it's a problem with the loop of checked boxes I'm guessing. Am I doing this right? Here is the div it's looping through:

<div id="termSheetPopup">
                        <div style="text-align:center;">
                            <select id="termSheetType">
                                <option>Internal</option>
                                <option>Borrower Facing</option>
                            </select>
                        </div>
                        <input type="checkbox" name="SummaryInformation">Summary Information<br />
                        <input type="checkbox" name="ProductLegs">Product Legs<br />
                        <input type="checkbox" name="AmortizationOptions">Amortization Options<br />
                        <input type="checkbox" name="Values">Values<br />
                        <input type="checkbox" name="Rates">Rates<br />
                        <input type="checkbox" name="RatesSpecific">Rates (All-In-Rate, PV01)<br />
                        <input type="checkbox" name="AmortizationSchedule">Amortization Schedule<br />
                        <input type="checkbox" name="SponsorInfo">Sponsor/Affiliate Info<br />
                        <input type="checkbox" name="BorrowerInfo">Borrower Info<br />
                        <input type="checkbox" name="SponsorContacts">Sponsor/Affiliate Contacts<br />
                        <input type="checkbox" name="CashFlows">Cash Flows<br />
                        <input type="checkbox" name="PrePayment">Pre-Payment<br />
                        <input type="checkbox" name="FutureExposure">Potential Future Exposure<br />
                        <input type="checkbox" name="FutureExposureSpecific">Potential Future Exposure (Max Number and Date Only)<br />
                        <input type="checkbox" name="History">History<br />
                    </div>

Thanks.

EDIT:

Calling GenerateTermSheet() here:

$('#termSheetPopup').dialog({
            modal: true,
            resizable: false,
            title: 'Generate Term Sheet',
            width: 375,
            height: 425,
            autoOpen: false,
            buttons: {
                "Generate": function () {
                    GenerateTermSheet();
                },
                "Cancel": function () {
                    $(this).dialog("close");
                }
            }
        });
3
  • Where are you calling GenerateTermSheet() ? Commented Feb 10, 2011 at 21:40
  • Added, but it's calling correctly because I can alert after setting urlString and it works. Commented Feb 10, 2011 at 21:43
  • By the way... even if <input> works without closing tag, it's not a reason to not close them... It is a good habit to always close your tags. Commented Feb 10, 2011 at 21:48

5 Answers 5

1

you could try the following selctor:

#termSheetPopup input[type="checkbox"]:checked

Maybe this link will support you: http://www.electrictoolbox.com/check-uncheck-checkbox-jquery/

Sign up to request clarification or add additional context in comments.

Comments

0

As I mentioned in my comment, you are never telling JS when to execute the function. See my live demo. Seems to work OK if I strip out the ASP stuff.

http://jsfiddle.net/db4Uf/1/

This is the key line

//When an input in termSheetPopup is clicked, call GenerateTermSheet()
$('#termSheetPopup input').click(function(){
    GenerateTermSheet();
});

2 Comments

I want to call this when a button on the JQuery dialog is clicked, which is working fine. If I put the alert on the first line of the function I can see it appear. It doesn't appear however if I move it underneath the selector
That means there is a problem with your selector. Nothing is being found, hence the lack of an alert()
0

Try changing the selector to:

$( '#termSheetPopup input[type=checkbox][checked]' )

1 Comment

I think you mean :checked instead of [checked]
0

Try :checkbox:checked (note the additional colon).

Comments

0
$(document).ready(function() {
    $('#selecctall').click(function(event) {  //on click 
        if(this.checked) { // check select status
            $('.checkbox1').each(function() { //loop through each checkbox
                this.checked = true;  //select all checkboxes with class "checkbox1"               
        });
    } else {
        $('.checkbox1').each(function() { //loop through each checkbox
            this.checked = false; //deselect all checkboxes with class "checkbox1"                       
        });         
    }
});

});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.