Click here to Skip to main content
15,888,454 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to refresh the ASP.Net page after asynchronously updating the contents of page Pin
Paramhans Dubey23-Aug-10 2:13
professionalParamhans Dubey23-Aug-10 2:13 
AnswerRe: How to refresh the ASP.Net page after asynchronously updating the contents of page Pin
Not Active23-Aug-10 4:17
mentorNot Active23-Aug-10 4:17 
GeneralRe: How to refresh the ASP.Net page after asynchronously updating the contents of page Pin
Paramhans Dubey23-Aug-10 18:30
professionalParamhans Dubey23-Aug-10 18:30 
GeneralRe: How to refresh the ASP.Net page after asynchronously updating the contents of page Pin
Not Active24-Aug-10 4:26
mentorNot Active24-Aug-10 4:26 
GeneralRe: How to refresh the ASP.Net page after asynchronously updating the contents of page Pin
Paramhans Dubey24-Aug-10 23:14
professionalParamhans Dubey24-Aug-10 23:14 
GeneralRe: How to refresh the ASP.Net page after asynchronously updating the contents of page Pin
Not Active25-Aug-10 2:16
mentorNot Active25-Aug-10 2:16 
GeneralRe: How to refresh the ASP.Net page after asynchronously updating the contents of page Pin
cramteke30-Aug-10 0:45
cramteke30-Aug-10 0:45 
QuestionSpent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
Albert8322-Aug-10 20:12
Albert8322-Aug-10 20:12 
Hi I have a form with text fields that I am trying to validate. I get this error and validation fails. Firefox error Console shows:

Error: document.Registring.elements.fieldName is undefined

It doesn't recognize fieldName as variable. Without runat="server" I think the issue disappears. How to fix this?


Thank you.


Here is the snippet:


<script type="text/javascript">
function checkform(fieldName) {
var fieldIs = document.Registring.elements[fieldName].value;

if (fieldIs == "")
return false;
else
return true;
}
function ValidateFields() {
var errorMessage = "";
var returnResult = true;

//Personal Information
if (!checkform('FirstName')) {
errorMessage += "First Name is a required field \n";
returnResult = false;
}
if (!validateInputType('FirstName', "letters")) {
errorMessage += "First Name should contain letters only \n";
returnResult = false;
}

}

function validateInputType(fieldName, inputType) {

if (inputType == "digits") {
var isNumber = document.Registring.elements[fieldName].value;


//digits only
if (isNumber.match(/^\d+$/))
return true;
else
return false;
}
else if (inputType == "letters") {
var isLetter = document.Registring.elements[fieldName].value;

//letters only
if (isLetter.match(/[a-zA-Z]/))
return true;
else
return false;
}
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title> Reservations </title>

<form runat="server" name="Registring" onsubmit="return ValidateFields();" id="Registring" method="post">
<table width="100%">
<tr>
<td>
<table border="0" width="100%" style="height: 260px;">

<tr>
<td colspan="2" style="background-color: #8c93a5; font: arial 14px; font-weight:bold">PERSONAL INFORMATION</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right" style="width: 230px"><span>*</span><b>First Name:</b></td>
<td><input type="text" runat="server" name="FirstName" size="30" /></td>
</tr>

</table>

<input runat="server" type="image"
src="images/btn_submit.gif"
name="Order" value="Reserve" align="top"
/><br />

</form>

</body>
</html>
AnswerRe: Spent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
NeverHeardOfMe22-Aug-10 22:44
NeverHeardOfMe22-Aug-10 22:44 
GeneralRe: Spent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
R. Giskard Reventlov22-Aug-10 22:49
R. Giskard Reventlov22-Aug-10 22:49 
GeneralRe: Spent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
Albert8323-Aug-10 7:14
Albert8323-Aug-10 7:14 
GeneralRe: Spent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
NeverHeardOfMe23-Aug-10 7:30
NeverHeardOfMe23-Aug-10 7:30 
GeneralRe: Spent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
Albert8323-Aug-10 7:34
Albert8323-Aug-10 7:34 
GeneralRe: Spent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
NeverHeardOfMe23-Aug-10 8:06
NeverHeardOfMe23-Aug-10 8:06 
GeneralRe: Spent hours, can't figure out. Javascript dynamic form variable with asp.net Pin
Albert8323-Aug-10 10:42
Albert8323-Aug-10 10:42 
Questionchemistry program Pin
albertodiprima21-Aug-10 20:33
albertodiprima21-Aug-10 20:33 
AnswerRe: chemistry program Pin
Yusuf21-Aug-10 20:58
Yusuf21-Aug-10 20:58 
AnswerRe: chemistry program Pin
koolprasad200322-Aug-10 1:24
professionalkoolprasad200322-Aug-10 1:24 
AnswerRe: chemistry program Pin
Sandeep Mewara22-Aug-10 8:21
mveSandeep Mewara22-Aug-10 8:21 
GeneralRe: chemistry program Pin
albertodiprima22-Aug-10 8:25
albertodiprima22-Aug-10 8:25 
GeneralRe: chemistry program Pin
albertodiprima22-Aug-10 8:27
albertodiprima22-Aug-10 8:27 
GeneralRe: chemistry program Pin
Blue_Boy22-Aug-10 21:30
Blue_Boy22-Aug-10 21:30 
GeneralRe: chemistry program Pin
albertodiprima23-Aug-10 0:30
albertodiprima23-Aug-10 0:30 
AnswerRe: chemistry program Pin
Keith Barrow14-Jul-11 3:03
professionalKeith Barrow14-Jul-11 3:03 
GeneralRe: chemistry program Pin
Pete O'Hanlon14-Jul-11 3:11
mvePete O'Hanlon14-Jul-11 3:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.