开发者

Can't check checkboxes after passing parameter - grails / javascript / facebox

开发者 https://www.devze.com 2023-04-06 11:51 出处:网络
I\'m doing some ajax requests in Grails 1.3.7. The front end uses jQuery and the \'facebox\' plugin. After a successful request and response, I redirect back to the page with a \'confirm\' param whic

I'm doing some ajax requests in Grails 1.3.7. The front end uses jQuery and the 'facebox' plugin.

After a successful request and response, I redirect back to the page with a 'confirm' param which is picked up by javascript.

The facebox plugin works fine on its own, but when I pass the 'confirm' parameter, the facebox popup works, but the checkboxes on the popup are unclickable (they aren't disabled, the arrow just doesn't show up when you click them). This was tested in Chrome and FF. I thought it might be a duplicate ID issue, but I made sure the checkbox and IDs were unique.

Any ideas? Or is there a better way to do this?

Grails action:

def deleteEmailRecipient = {
        def recipientId = params.id
        accountService.deleteEmailRecipient(recipientId)
        redirect(action:'settings', params:[confirm:1])
    }

JS:

$(document).ready(function() {
    //get params to display save confirm if confirm detected
    var url = window.location.toString();
    url.match(/\?(.+)$/);
    var params = RegExp.$1;
    var splitParams = params.split("&");

    for (var i=0;i<splitParams.length;i++) {
        var tmp = splitParams[i].split("=");

        if (tmp[0] == 'confirm') {
            $.facebox({div: '#addWord'});
        }
    }
});

GSP (开发者_JAVA技巧that shows up in facebox):

<div class="checkboxes" style="border: 1px solid #FFFFFF;">
    <g:each in="${wordGroups}" var="wg" status="i">
       <label class="category">
          <g:checkBox name="${wg.id}"/>
          <span style="font-weight:bold;margin-right:5px;white-space: nowrap;">
              <img class="dropdownFlag" src="${resource(dir:'images',file:icon)}" alt="" />${wg.name}
          </span>${(i+1)%4 == 0 ? '<br />' : ''}
       </label>
    </g:each>
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消