HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 21st, 2001, 02:15 AM
DukeNM DukeNM is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 50 DukeNM User rank is Private First Class (20 - 50 Reputation Level)DukeNM User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via ICQ to DukeNM
Question

Is there anyway to do the following:
(HTML Form)

appcode: 1

deg/dip/cert field major-subject
------------------------------------------------------
row1 BSc Maths Maths
row2 HSC Science Electronics
row3 SSC

SUBMIT button.

but what happens here is that there is no check put forth....what i actually want is,
if a person enters in column1 the remaining 2 column entries should become compuslory (ie. shouldnt be left NULL)

let me give the above eg.
now in row1, all three columsn filled, so no probs.
no person enters in row2, he fills all three columns, again no probs. but...
in row3 he has entered only SSC, but he does not enter the field, and major-subject column.

So is there a kind of check that can be performed that once the person enters something in the first column (or say certain column), some of the other columns should be made compulsory, based on that specific (certain) column.?


I am giving you an example url, which is something i want in a practical way.
http://akshaysalkar.tripod.com/FormPg4.htm

hope anyone can help.
ak.

Reply With Quote
  #2  
Old January 22nd, 2001, 07:16 PM
AhrT AhrT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Australia
Posts: 23 AhrT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Working with the sample page, you could do something simple (and a little bloated) like:


<script type="text/javascript" language="JavaScript">
// Array with all the fields for individual rows per element
var fieldArray = new Array();
fieldArray[0] ="textfield2243373207,textfield2243373386272,textfield22433733862132,textfield2243373447,textfield2243 373502,textfield22433735022"
fieldArray[1] ="textfield22433732072,textfield22433733862722,textfield224337338621322,textfield22433734472,textfield 2243373512,textfield22433735023"


function checkFields() {
var errorString = "";
for (var i = 0; i < fieldArray.length; i++) {
tmpElement = fieldArray[i].split(",");
var gotBlank = 0;

for (var ii = 0; ii < tmpElement.length; ii++) {
tmpField = tmpElement[ii];
if (document.forms.form1.elements[tmpField].value == "") {
gotBlank++;
}
}
if (gotBlank < tmpElement.length && gotBlank > 0) {
errorString += "You gotta fill out all the fields for row " + i + "n";
}
}

if (errorString != "") {
alert(errorString);
return false;
} else {
return true;
}
}
</script>

and make sure on your FORM you have:

<form name="form1" onSubmit="return checkFields();">

This will check each row and if only some of the fields are filled in for that row it will give the error. It's not elegant but see if this is a useful base for improving on and making more robust.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Add entries in Form depending on previous entries?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT