|
keep some hidden button in the page and call button1.click()
or
__dopostback("","")
or
this.form[0].submit()
|
|
|
|
|
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> </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>
|
|
|
|
|
try replacing
document.Registring.elements[fieldName].value
with
document.getElementByID(fieldName).value
|
|
|
|
|
and add an id attribute to the item as: <input type='text' runat='server' id='xxx' name='xxx' ... etc.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Thanks for the response. I am getting an error in firefox: Error: document.getElementByID is not a function
|
|
|
|
|
Well, it is... make sure you have replaced your square brackets [] with round ones (), that your spelling is correct, and that you have also followed the advice of digital man following my earlier post.
|
|
|
|
|
Thanks. This is the code I have used: var fieldIs = document.getElementByID(fieldName).value;
And I have added id as follows: <input type="text" runat="server" id="FirstName" name="FirstName" size="30" />
Is that how it should be?
|
|
|
|
|
OK, sorry - my bad - should be lower-case d at teh end:
getElementById
(case-sensitive)
|
|
|
|
|
|
i'm developing a program but i don't where to start,please help me
|
|
|
|
|
You need to start at gathering requirements for the app you are going to develop. What is the app suppose to do? what functionality do you want to support? who is the target audience? Once you have the requirements, it should flow the process pretty easily.
Your requirements come from your user/project lead/product manager or sometimes you have to gather it for yourself.
If this is a school HW, then either you need to make it up or I find it easier to talk to someone in the field of the app you are trying to develop.
Good Luck!
|
|
|
|
|
Decide the input and output of your code...then start developement
follow the SDLC...
Rating always..... WELCOME
Be a good listener...Because Opprtunity Knock softly...
Use http://www.google.com/transliterate/ for translator
|
|
|
|
|
Ok, start from here... What do you mean by 'Chemistry Program'?
|
|
|
|
|
i want create an ambient for molecule but i don't know the command for do this
|
|
|
|
|
i'm using pspad and visual c
|
|
|
|
|
I'm very curious to know more about your project, and I would like to help you.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
|
Step 1: Decide what ever a chemsity program is. (What does it do: get atomic/molecular weights, simuate mocules, calculate statistical thermodynamics properties)?
Step 2: Decide what features you need to fulfill your ideas from step 1, and keep breaking down until you have managable problems
Step 3: Implement the features, writing tests as you go.
|
|
|
|
|
Step 3: Write test, then implement feature.
|
|
|
|
|
hi,
Do you know whats is the best approach for implementing online shopping card?
I am new and need some help and article regarding this matter.
|
|
|
|
|
Did you try to search on google?
Here is a great google result[^] with useful links about your question.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
The first step would be to understand it is shopping cart not shopping card.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
you may need both.
|
|
|
|
|
|
Hello,
I have the following code in my Site.css file
.field-validation-error
{
color: #ff0000;
}
.field-validation-valid
{
display: none;
}
.input-validation-error
{
border: 1px solid #ff0000;
background-color: #ffeeee;
}
.validation-summary-errors
{
font-weight: bold;
color: #ff0000;
}
.validation-summary-valid
{
display: none;
}
BODY { font-family: Cambria, Georgia, "Times New Roman"; margin: 0; }
DIV#header DIV.title, DIV.item H3, DIV.item H4, DIV.pager A {
font: bold 1em "Arial Narrow", "Franklin Gothic Medium", Arial;
}
DIV#header { background-color: #444; border-bottom: 2px solid #111; color: White; }
DIV#header DIV.title { font-size: 2em; padding: .6em; }
DIV#content { border-left: 2px solid gray; margin-left: 9em; padding: 1em; }
DIV#categories { float: left; width: 8em; padding: .3em; }
DIV.item { border-top: 1px dotted gray; padding-top: .7em; margin-bottom: .7em; }
DIV.item:first-child { border-top:none; padding-top: 0; }
DIV.item H3 { font-size: 1.3em; margin: 0 0 .25em 0; }
DIV.item H4 { font-size: 1.1em; margin:.4em 0 0 0; }
DIV.pager { text-align:right; border-top: 2px solid silver;
padding: .5em 0 0 0; margin-top: 1em; }
DIV.pager A { font-size: 1.1em; color: #666; text-decoration: none;
padding: 0 .4em 0 .4em; }
DIV.pager A:hover { background-color: Silver; }
DIV.pager A.selected { background-color: #353535; color: White; }
then I try to load it in Site.master file:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link rel="Stylesheet" href="~/Content/Site.css" />
</head>
<body>
<form id="form1" runat="server">
<div id = "header">
<div class = "Tittle" align="center" >SportsStore</div>
</div>
<div id = "Categories" >
Will put something here.
</div>
<div id="Content">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
the problem is after I run the program, nothing applied.
could you please tell me what is the problem.
|
|
|
|