2013-10-28 3 views
0

기본적으로 NSURLConnection을 사용하여 웹 양식 데이터를 게시하는 방법을 알고 있습니다. 그러나 문제는 웹 양식에 3 개의 제출 버튼이 있으며, 그 중 하나를 클릭하면 서버가 클릭 한 것을 확인합니다. iOS 또는 코코아에서 서버에 대해이 사실을 어떻게 알릴 수 있습니까?웹 양식 제출 버튼의 정보를 코코아 서버에 게시하는 방법은 무엇입니까?

<form name="myform" action="checkLogin.jsp" method="post" onSubmit="return checkSubmit();"> 
    <table cellspacing="0" cellpadding="0" width="100%" border="0"> 
     <tr> 
     <td height="38" width="80" class="login_txt">account:&nbsp;&nbsp;</td> 
     <td width="200"><input type="text" class="editbox4" name="username" id="username" value="" size="20" maxlength="24"></td> 
     <td width="240">&nbsp;</td> 
     </tr> 
     <tr> 
     <td height="35" class="login_txt">password: &nbsp;&nbsp;</td> 
     <td><input type="password" class="editbox4" name="password" id="password" size="20" maxlength="24" style="height: 25px;vertical-align: middle;"> <img src="public/images/luck.gif" width="19" height="18" style="vertical-align: bottom;"></td> 
      <td>&nbsp;</td> 
     </tr> 
     <tr> 
     <td height="35" class="login_txt">ip:&nbsp;&nbsp;</td> 
     <td><span class="login_txt">118.228.173.165</span><input type="hidden" name="ip" value="118.228.173.165"> </td> 
     <td>&nbsp;</td> 
     </tr> 
     <tr> 
     <td height="35" colspan="3"><input type="submit" value="connect" class="login_button" name="action"> <input type="submit" value="disconnect" class="login_button" name="action"> <input type="submit" value="manage" class="login_button" name="action"></td> 
     </tr> 
    </table> 
</form> 

답변

0

하는 입력 폼에서 특별한 조금이다 제출 : 여기

은 HTML의 폼의 코드입니다.

브라우저에서 항상 양식의 모든 입력/텍스트 상자/모든 것에 값을 전송합니다. 제출 단추를 제외합니다. 클릭 한 제출 버튼 만 보냅니다. 당신은 분리 버튼을 클릭한다

username: hello 
password: world 
action: connect 

을 또는 : 당신이 connect 버튼을 클릭하면 예를 들어

, 전송되는 데이터는 다음과 같이됩니다 따라서

username: hello 
password: world 
action: disconnect 

, 당신을 NSURLConnection에서 올바른 작업을 보내 서버에서 수행해야하는 작업을 선택할 수 있습니다.

관련 문제