This is a migrated thread and some comments may be shown as answers.

[Solved] Submitting data from side and window

1 Answer 35 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andre
Top achievements
Rank 1
Andre asked on 23 May 2011, 09:17 AM
Hi.

we´ve got a problem with the window-control.
We have a view with a Form containing a Textbox "Name1".

The form contains a window with a Textbox "Name2" and a Button with JavaScript attached to submit the form.
The Window itself has no additional Form.

When Debugging the Action-method, the Textbox-Value for "Name2" in the window will not be submitted.
We need to submit both values.

The Code looks like this:

        @Using Html.BeginForm()
        
        @<input type="text" name="Name1" id"Name1" />
        @<button type="submit" Id="feedback-open-button" >Submit feedback!</button>
        
        Html.Telerik.Window.Name("Window") _
            .Title("Submit feedback") _
            .Content(Function(c)
            @<input type="text" name="Name2" id"Name2" />
            @<button id="LocationButton" class="t-button t-state-default">Submit feedback...</button>       
                         Return c
                     End Function) _
            .Width(400) _
            .Draggable(True) _
            .Modal(True) _
            .Visible(False) _
            .Render()

               

End Using

@code
    Dim script As String = String.Empty
    
    script &= "$('#feedback-open-button').click(" & vbCrLf
    script &= "function(e)" & vbCrLf
    script &= "{" & vbCrLf
    script &= "e.preventDefault(); " & vbCrLf
    script &= "$('#Window').data('tWindow').center().open(); " & vbCrLf
    script &= "}); " & vbCrLf

    
    script &= "$('#LocationButton').click(function(e) {" & vbCrLf
    script &= "  document.forms[0].submit(); " & vbCrLf
    script &= "$('#feedback-form').closest('.t-window').data('tWindow').close();" & vbCrLf
    script &= "});"
           
    Html.Telerik.ScriptRegistrar().OnDocumentReady(script)    
          
       
End Code

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 23 May 2011, 10:04 AM
Hi Andre,

 The window detaches itself from the DOM once opened in order to appear on top of other HTML elements. This causes the input elements to no longer be inside the <form> element. Thus they are not posted. You need to put the form inside the window contents.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
Andre
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or