binder issue

I am having issues with using binder's. The view has the right name id attribute,and application.json have the deploy plus use an htmlframemojit. I didnt change the standard init function in the binder because i felt it wasnt needed. In the bind function i did a

window.open call but
bind: function(node) {
var newwindow = window.open(encodeURIComponent(mp.node.one('#urlquery').value),'_self');

the url button id is urlbutton the text input id is urlquery

Is it adequate? I realize i am missing something big in the setup but i dont see it. The model doesnt have to change with the binder. And, the controller doesnt need it change either. The view require the id'd elements to exist. they do.

1 Reply
  • Hello,

    This doesn't seem to be related to Mojito. See below on how to do this correctly. Particularly, you should be using node.one not node.all. node.all to my understanding returns a list, which you would have to iterate through in order to subscribe to events. The mojitProxy is not needed at all, just use the node object passed through the bind method.

    node.one('#urlbutton').on('click', function (e) { var newWindow = window.open(encodeURIComponent(e.target.get('value'), '_self'); });

    Let me know if you have any further questions.

  • I got it to work. After a js check it said my node.one is returning null. I had to not do the url encode. I had to not place a incorrect string and i had to make sure I used the right format for id elements, which i regrettably messed up on.

    node.one("#urlbutton").on("click", function (e) { var newWindow = window.open("two?url="+node.one("#urlquery").get("value"), "_self"); });

    thanks for your help.


Recent Posts

in Yahoo! Mojito