Hi
I have a cshtml where in I load partial view as follows.
@{Html.RenderPartial("SavePopUp", Model.SavePopUp);}
The partial view is loaded as popup which is as below..
<input id="myId" type="text" name="myId">
<input id="SaveId" type="submit" class="button" value="Save Id" onclick="return Func1(); />
function Func1() {
var Value1 = document.frmUpload.myId.value;
var Value1 = self.document.getElementById("myId").value;
var Value1 = this.document.getElementById("myId").value;
if ($.trim(Value1) == "") {
alert(self.document.getElementById("myId").value);
alert("Please select a value for Id.");
return false;
}
return true;
}
My requirement is in the popup when the Id is empty, I should not allow submit. Problem I am facing is first time I clicked submit button when empty, the validation throws up fine. Next time I entered value into Text box in the popup and click submit, still the message "Please select a value for Id." Message comes up, when I try to alert the value of textbox in the popup it says empty even if I entered value.
Could you please suggest why in popup we face this problem even if I entered value second time, it still says “Please select a value”. Is there any confusion for the popup window as in this scenario we have a main window and a popup window. Could you please suggest.
Thank you.
Best regards,
Joseph.