/    Sign up×
Community /Pin to ProfileBookmark

2 similar input validations on one form

Hi, I need to have two user input dates validated on a single form when the user clicks submit. At the moment I only hvae it validating one date and I’m not sure how to have it check the other, do I need some sort of a loop?

The form code is:

[code]<form name=”startDateForm” method=”post” action=”pass.jsp” onSubmit=”return ValidateForm()”>

<input name=”projectStartFromDate” type=”text” id=”projectStartFromDate”>

<input name=”projectStartToDate” type=”text” id=”projectStartToDate”>[/code]

The Validation function is:

[code]function ValidateForm(){
var dt=document.startDateForm.projectStartFromDate
if(dt.value == ”) return true;
else if(isDate(dt.value)==false){
dt.focus()
return false
}
return true
}[/code]

The isDate function called upon just defines the number of days in each month etc.

Thanks

EDIT:[URL=http://pearly.zftp.com/jordan/hosting/date.html]Link to doc if needed[/URL]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @bldstr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...