Completed
Last Updated: 21 Apr 2017 14:10 by ADMIN
ADMIN
Marin Bratanov
Created on: 30 Mar 2017 10:28
Category: Window
Type: Bug Report
1
RadWindowManager templates POST the page when enter is pressed on a focused textbox
This is caused by <button> elements without a type attribute. Workarounds are

- add a JS function like this

Sys.Application.add_load(function () {
    // Add the "type=button" attribute to the RadWindow buttons so they don't try to submit the form.
    $("div.rwDialogButtons button").attr("type", "button");
});

 - OR, override the templates and add the attribute:

			<asp:TextBox ID="Textbox1" runat="server" />
			<telerik:RadWindowManager ID="rwm1" runat="server" RenderMode="Lightweight">
				<AlertTemplate>
					<div class="rwDialog rwAlertDialog">
						<div class="rwDialogContent">
							<div class="rwDialogMessage">{1}</div>
						</div>
						<div class="rwDialogButtons">
							<button type="button" class="rwOkBtn" onclick="$find('{0}').close(true); return false;">##LOC[OK]##</button>
						</div>
					</div>
				</AlertTemplate>
				<PromptTemplate>
					<div class="rwDialog rwPromptDialog">
						<div class="rwDialogContent">
							<div class="rwDialogMessage">{1}</div>
							<div class="rwPromptInputContainer">
								<script type="text/javascript">
									function RadWindowprompt_detectenter(id, ev, input) {
										if (!ev) ev = window.event;
										if (ev.keyCode == 13) {
											var but = input.parentNode.parentNode.parentNode.getElementsByTagName("button")[0];
											if (but) {
												if (but.click) {
													but.click();
												}
												else if (but.onclick) {
													but.focus();
													var click = but.onclick;
													but.onclick = null;
													if (click) click.call(but);
												}
											}
											return false;
										}
										else return true;
									}
								</script>
								<input title="Enter Value" onkeydown="return RadWindowprompt_detectenter('{0}', event, this);" type="text" class="rwPromptInput radPreventDecorate" value="{2}" />
							</div>
						</div>
						<div class="rwDialogButtons">
							<button type="button" class="rwOkBtn" onclick="$find('{0}').close(this.parentNode.parentNode.getElementsByTagName('input')[0].value); return false;">##LOC[OK]##</button>
							<button type="button" class="rwCancelBtn" onclick="$find('{0}').close(null); return false;">##LOC[Cancel]##</button>
						</div>
					</div>
				</PromptTemplate>
				<ConfirmTemplate>
					<div class="rwDialog rwConfirmDialog">
						<div class="rwDialogContent">
							<div class="rwDialogMessage">{1}</div>
						</div>
						<div class="rwDialogButtons">
							<button type="button" class="rwOkBtn" onclick="$find('{0}').close(true); return false;">##LOC[OK]##</button>
							<button type="button" class="rwCancelBtn" onclick="$find('{0}').close(false); return false;">##LOC[Cancel]##</button>
						</div>
					</div>
				</ConfirmTemplate>
			</telerik:RadWindowManager>
0 comments