2014-05-12 3 views
0

유성에 간단한 양식이있어서 내 사용자 정의 응용 프로그램의 실행을 구성하는 데 도움이됩니다. 이 양식은 Username과 Password라는 두 개의 인수를받습니다. 내가 child_process를 사용하여 내 외부 응용 프로그램을 실행하고 외부 응용 프로그램에 인수로이 값을 전달할 수 있도록Meteor에서 서버에 양식 값을 전달하십시오.

<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Execute my custom app</title> 
</head> 

<body> 
    {{> configDetails}} 
</body> 

<template name="configDetails"> 
    <div class="container"> 
     <form class="form-signin" role="form" id="form-signin" > 
      <div class="row"> 
       <div class="span3 offset"><input type="textBox" class="input-block-level" placeholder="User Name" ></div> 
       <div class="span3 offset1"><input type="textBox" class="input-block-level" placeholder="Password" ></div> 
      </div>               
      <input class="btn btn-lg btn-primary" type="submit" style="display: block; width: 100%;" id="submit"/>  
     </form> 
    </div> 
</template> 

지금 나는이 값은 서버 측에서 수신하고자합니다. 어떻게 유성 서버 섹션에서이 값을받을 수 있습니다 : 나는 클라이언트 섹션을 받아 서버에 전달할 수있는 방법 값이 직접 서버 섹션에서 수신 할 수없는 경우

if (Meteor.isServer) { 
    //I intend to use child_process to run my external application here 
} 

. 클라이언트 섹션에서도 문제가 발생합니다.

if (Meteor.isClient) { 

    Template.configDetails.events({ 
    'click input': function() { 
     console.log('Submitting form!'); 
     // template data, if any, is available in 'this' 
     if (typeof console !== 'undefined') 
     console.log("You pressed the button"); 
    } 
    }); 

    Template.configDetails.events({ 
    'submit form': function(event){ 
     console.log('Submitting form!'); 
     event.preventDefault(); 
     event.stopPropagation(); 
     return false; 
    } 
    }); 

위의 기능은 console.log 메소드를 실행하지 않습니다. 어떤 생각을 잘못했는지. 추가 정보가 필요한 경우 알려주십시오. 내 projets에서

답변

1

나는 다음과 같이 떨어지게을 사용하고 있습니다 :

Template.configDetails.events({ 
    "click #submit": function(e, t) { 

    e.preventDefault(); 

    Meteor.call('someMethod', attributes, function(error, id) { 
     if (error) { 
     return console.log("Error.........."); 
     } else { 
     //Do smth 
     } 
    }); 
    }); 

} 
}); 
+0

확인을. 그래서 다시 console.log를 실행하지 않은이 코드를 입력했습니다 : Template.configDetails.events ({ "click #submit": function (e, t) { console.log ('Submiting form!'); e.preventDefault(); }}); – umbersar

+0

난 그냥 코드와 모든 작동하는 새로운 애플 리케이션을 만들었습니다 (- :보세요! [http://testevent.meteor.com/](http://testevent.meteor.com/) – none

+0

나는 콘솔을 확인했다 어디에서 유성 응용 프로그램을 시작했는지 알 수 있었지만 브라우저 콘솔에서 결과를 확인해야했습니다. – umbersar

관련 문제