Form Panel + ContentFrompage not working

  1. #1

    Form Panel + ContentFrompage not working

    Hi,

    I have a form panel like so:

        @(Html.X().FormPanel()
               .Method(HttpMethod.POST)               
               .ID("AddMemoForm")
               .Title("Add Memo")   
               .Cls("memo-form")                
               .Frame(false)
               .Border(false)
               .ContentFromPage(this, "~/Views/Common/MemoForm.cshtml")          
               )
    The Memo form view is:

    @model MemoFormModel

    <div class="memo-form">
        <table class="details" cellpadding="0" cellspacing="0">        
            <tr>            
                <td class="data-item">@Html.X().TextFieldFor(model => model.User)</td>  
                <td>@Html.X().Button().Text("...")</td>
            </tr>        
            <tr>       
                <td class="data-item">@Html.X().TextFieldFor(model => model.Subject)</td>            
            </tr>
            <tr>            
                <td class="data-item">@Html.X().TextFieldFor(model => model.Caption)</td>            
            </tr>    
        </table>
    </div>
    However the view does not show. Using developer tools I can see the view is brought into the page but given a class of x-hidden. I tried removing the cls but that did not work. If I use ItemsFromPage it shows the items but I lose my HTML tags as you'd expect.

    How do I bring the content from memoform into the form panel ?
  2. #2
    FormPanel doesn't support Content, please use Panel
  3. #3
    Hi Vladimir,

    Yep panel works fine.

    How do I then submit the data in the panel?

    Originally the plan was to use javescript like so:

    function SubmitForm() {
                App.AddMemoForm.getForm().submit({
                        url: 'Home/AddMemo'                
                });
            }
    Thanks for the help
  4. #4
    Use standard html form, DirectEvent or DirectMethod and define FormID for direct request
  5. #5
    ok I tired this but diod not work.

    Panel wrapped in Html Form:

    <form id="AddMemoForm" action="Home/Addmemo" method="POST">
    <div class="memo-create">
        @(Html.X().Panel()                        
                .Title("Add Memo")            
                .Cls("memo-form")     
                .ContentFromPage(this, "~/Views/Common/MemoForm.cshtml")           
                .Frame(false)
                .Border(false)           
                )
    </div>
    </form>
    and then javascript to submit it

            function SubmitForm() {
                document.getElementById("AddMemoForm").submit();
            }
    However this doesn't work. i can see through the developer tools that the request body is empty.
  6. #6
    Hi Vladimir,

    I think this is where you were pointing me but still does not work:

    <form id="AddMemoForm">
    <div class="memo-create">
        @(Html.X().Panel()                        
                .Title("Add Memo")            
                .Cls("memo-form")     
                .ContentFromPage(this, "~/Views/Common/MemoForm.cshtml")           
                .Frame(false)
                .Border(false)           
                )
    </div>
    <div class="submit-panel">
            @(Html.X().Button()
               .Text("Submit")
               .Width(150)           
               .DirectEvents(de=>
                    {                   
                        de.Click.FormID = "AddMemoForm";                              
                        de.Click.Url = Url.Action("AddMemo");                             
                    })                
                  )
        </div>
    Can you advise on what to change please?

Similar Threads

  1. [CLOSED] application not working after using form authentication ( MVC 4 )
    By pawangyanwali in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 02, 2012, 3:43 PM
  2. Replies: 5
    Last Post: May 11, 2012, 4:56 PM
  3. [CLOSED] Panel layout type seems to break when using ContentFromPage
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 26, 2012, 7:20 AM
  4. Replies: 8
    Last Post: Dec 28, 2011, 4:07 AM
  5. [CLOSED] Form reset not working
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 22, 2010, 7:01 AM

Posting Permissions