2013-09-16 2 views
2

중첩 된 양식이있는 방법은 있습니까? 내가 중첩 된 형태중첩 된 양식의 솔루션

+1

중첩 된 양식으로 달성하고자하는 것은 무엇입니까? 참고 사항 : HTML5 양식 요소는 '

'요소 외부에있을 수 있으며 [form-attribute] (http://www.w3.org/TR/2011/WD-html5-20110525) 요소를 사용하여 결합됩니다. /association-of-controls-and-forms.html#attr-fae-form). – insertusernamehere

답변

3

아니 당신이 중첩 된 수없는 형태지만 문제에 대한 간단한 해결책이없이 동일한 기능을지고 돌아 다니면서 얼마나이

<form action="" method="post"> 
    <input type="text".... /> 
    <input type="text".... /> 
    <form action="some action"> 
     <input type="submit" .... /> 
    </form> 
</form> 

없는 경우 같은

.

//if user clicks on the first submit button, action1 is triggered 
if (isset($_POST['action']) && $_POST['action'] == 'action1') { 
    // do something  
} 

//if user clicks on the second submit button, action2 is triggered  
if (isset($_POST['action']) && $_POST['action'] == 'action2') { 
    // do something else 
} 

PS :

<form action="" method="post"> 
    <input type="submit" name="action" value="action1" /> 
    <input type="submit" name="action" value="action2" /> 
</form> 

당신은이 코드는 양식 제출을 처리하는 PHP를 사용하는 경우

public class ExampleController : Controller 
{ 
    .... 

    [HttpPost] 
    public ActionResult Index(string action) 
    { 

     if (!string.IsNullOrEmpty(action) == "action1") { 
      // Do something 
     } 

     if (!string.IsNullOrEmpty(action) == "action2") { 
      // Do something 
     } 
    } 

    ... 
} 
: 나는 당신이 C# 및 .NET 작업을 볼 때, 이것은로 번역 될 것이다
관련 문제