Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This is for a hobby online simulati 1

Status
Not open for further replies.

schase

Technical User
Sep 7, 2001
1,756
US
This is for a hobby online simulation

I have a form table - top row I would select Mission (the values are
derived from a recordset for tblMissions).

next 8 rows have the following.

Mission | Callsign | Kills | Death | Bombing |

This form is for whoever hosts a flight - they then goto the website and
enter the scores for each pilot. I would like the Mission column to be
hidden fields - pulling the value selected above in the first row. Callsign
is then pulled from values of a separate recordset for tblPilots - and the
rest is entered normally.

Since we can have anywhere from 1 to 8 max pilots - need the 8 rows.

This then populates however many records into tblScores for later Queries.

Problem I am running into - Is I start the form - the default value of
mission is on the first alphabetical one - I change it none of the 8 data
rows change - they all stay with whatever the first selection was.

Any ideas how to make each of the 8 mission rows requery after a selection
is made?

 
I would submit the form to itself based on a "onChange" value on the first field. Then you just have to make sure that your other query's are based off of your first field and they should always stay up to date.
 
thanks Yandso, I gave it a shot and got hung up. But, using one form to pass values to another form/table - then hit confirm and sends to a 3rd form that you never see what it does -

Using combination of code from Charon.co.uk and dreamweaver UltraDev tips.

It will probably seem cumbersome to some people, but it gives me what I need - easy to code, and gives a confirmation page to boot.

 
OK, this is not as hard as it seems. I just have one question. You mentioned that there can be up to eight pilots displayed on the screen where the user will provide scores for these pilots. Will you want to make sure that they provide scores for ALL pilots displayed on the screen or do you want to give them the ability to provide scores for one or two pilots and leave the scores for other pilots blank. I'll go ahead and assume that you want to validate that they provide scores for at least one pilot.

Let me know and I'll give you some great tips on how to accomplish this.

I'm going to be giving ASP examples so I just want to confirm you're server can understand ASP. (Probably a dumb question since you posted this in the ASP forum, but it's always nice to make sure :) )

ToddWW

 
lol hi Todd,

To answer - basically heres the low down.

Say I moderate (host) a flight, I copy down the mission name we flew, and the pilots who flew in it.

As the game progresses, I mark who lived, who did not, and at the end, who got what kills. And if they were tasked on a bombing mission or not.

I then goto the scores input form, enter the mission, enter all pilots who flew it, how many kills they got, whether they lived or died, and whether they bombed or not.

If a pilot died during the game - they get 1 point.
If they lived, they get 10 points, plus a point for each kill - or if they were bombing and lived, each mission has a bombing value. - makes up for the lack of air to air kills.

I could make it so even if they died, or had no kills, they put in zero.

The layout of how I have it now.

One table - one slot for mission flown(pulled from tblMission). 8 rows below with pilots callsign(drop down box pulling from tblPilots), #Kills, Lived(drop down with yes or no), and bombing (drop down with yes or no).

When submitted, that sends to another asp form that lists it all out. except it puts the mission to every row. - I want to have it pull the value of selecting Yes in alive = 10, and same for bombing(bombing value taken from tblMission). Then another column for the pilots total score for that flight. - a confirmation page of sorts. Then when it's submitted as correct - it populates tblScores.

Using Charon.co.uk's multiple record insertion - by the 3rd form I can get the columns to array and insert okay - but right now trying to figure out how to pass numerical value of selecting "Yes" to the 2nd form.

My level of asp is very beginner - I use UltraDev4, a couple of resource books and have some ability to look at code and figure out how it works and manipulate. - but not to the level of "ok, I need to type this code".

heres the link for what I've got.
Thank you for any ideas you may have.
 
OK, providing a link to the working site is very helpful. Passing the numerical values based on the selection in the list is no problem. But I see a bigger problem on form #2 the way it's designed now. So, answer these few questions for me.

#1: Are you saying that the value of the bombing can be different for each mission, yet the value of being killed is the same ?? If so, what is the fieldname in the tblMissions that holds the value for bombing ?

#2: On Page 2 / Form 2, I noticed that the form you are actually intending to submit is a collection of hidden fields. Does that mean that the text fields are there purely for display. Since you're currently setup to submit the hidden fields, changes to the values in the text fields won't pass to the 3rd form. Do you want to be able to change scores on this confirmation page before going to Page #3 and adding the records or is this for confirmation only??

#3: Give me the correct field names for the following:

tblPilots (Callsign)
tblMissions (Mission Name)
tblMissions (Bombing Value) - If that exists

I'm waiting patiently. :)

ToddWW
 
Oh, one more question.

Will you ever have the need to post more than one score for the same pilot in the same mission ? I only ask because your current layout will allow you to do that. You could potentially post 8 scores for the same pilot in the same mission. Is this realistic ??

ToddWW
 
Hi Todd,

Thank you so much for your help.

1)Correct - bombing value can change pending on the mission - could be no bombing at all, or could be worth say 5 points.

That is tblMissions.bomb_points - bomb_points being the field referenced. - and correct also - if you die you get 1 point, doesnt matter how many kills you got or if you bombed.

but if you lived and were air to air and got 5 points that would equal (living=10, kills 1 each) 15 points.
and say you were bombing and lived - and that mission's bomb value was 3 points you'd get 13 points.

2) It was a combination confirmation form and submit form. The only method I could figure out was to have the initial form page with fields Callsign1, Callsign2, etc....... Submit that to 2nd page that pulled all the values into text box's, name the text box's the same "callsign", then the code I found at Charon.co.uk would array all values for Callsign.

I figured to edit - they could hit back button.

tblPilots (Callsign) field is named "callsign"
tblMissions (Mission) name field is named "mission"
tblMissions (Bombing value) is named "bomb_points"

I don't have to have form 2 act the way it does - I was trying to fit code I knew worked into a way to make it work for me.

Once again, thank you so much.
 
No, there will only be a need to enter one score for one pilot.
 
would it help at all if I uploaded the asp pages to the web?
 
OK. Almost done with Page 1. Questions:

#1: Will all pilots fly in each mission, or could you potentially only want to post scores for a handful of pilots in the list ??

#2: Could a pilot potentially participate in a mission, get zero kills, die, and not bomb ??

ToddWW
 
handful of pilots - we expect 40 or 50 registered, but not all fly every mission every night. some pilots fly 160 missions a month, some only 3.

yes absolutly - lol me as well if they for instance crash into the ground due to pilot error they get 1 point - death=1, and thats it.
 
OK. Done !! One last thing. What are you using for your connection string to the database. Can you give me an example of one of your connections.

ie..

Conn.Open what goes here

OR

Recordset.Open SQL, what goes here

ToddWW :)
 
I use a include file....


This is an example on the recordset....


Missions.ActiveConnection = MM_gvfforce_STRING

Done already? daaamn, I've been at it over a week (and about 10 different thrown away methods)
 
I need the value of that string. Where are you setting the value to that string ?

ToddWW
 
Here is a recordset

<%
set Missions = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Missions.ActiveConnection = MM_gvfforce_STRING
Missions.Source = &quot;SELECT mission, bomb_points FROM tblMissions ORDER BY mission ASC&quot;
Missions.CursorType = 0
Missions.CursorLocation = 2
Missions.LockType = 3
Missions.Open()
Missions_numRows = 0
%>

Here is the include page

<%
' FileName=&quot;Connection_ado_conn_string.htm&quot;
' Type=&quot;ADO&quot;
' HTTP=&quot;true&quot;
' Catalog=&quot;&quot;
' Schema=&quot;&quot;
MM_gvfforce_STRING = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;\gvfforce\db\gvfforce.mdb&quot;)
%>
 
OK, here we go.. Now, there are many different ways to create recordsets, and yours is fine. However, just for testing purposes, create a test file and call it scorestest1.asp Copy this into that page and run it. Right now, I just want to make sure this page loads without any errors.

Then I'll explain the dynamics behind the ASP and JavaScript which will provide you with some good education for moving forward. Also, let's quit this forum thread and you can just email me at todd@fuelaccess.com

Don't put your include file into this page quite yet. Once we get it working, you can replace my recordset creation with your own so you can have the same design throughout your application. I'll also explain why I use these types of recordsets and connections.


<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim i
dim objRst
dim strQuery
dim strProvider

strProvider = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;\gvfforce\db\gvfforce.mdb&quot;)

%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script Language=&quot;JavaScript&quot;>
<!--
function checkForm(form_obj) {
var test = false
for (var m = 0; m < form_obj.elements.length; m++) {
if (form_obj.elements[m].name.search(/^Callsign/g) >= 0) {
if (form_obj.elements[m].options[form_obj.elements[m].selectedIndex].value != &quot;&quot;) {
test = true
}
}
}
if (test == false) {
window.alert(&quot;You Must Provide a Score For At Least One Pilot&quot;)
return false
}
for (var m = 0; m < form_obj.elements.length; m++) {
if (form_obj.elements[m].name.search(/^Bombed/g) >= 0) {
form_obj.elements[m].options[0].value = form_obj.MissionList.options[form_obj.MissionList.SelectedIndex].value
}
}
form_obj.Mission.value = form_obj.MissionList.options[form_obj.MissionList.SelectedIndex].text
window.alert(&quot;Validation Done. Normally form would submit at this point&quot;)
return false
}
//-->
</head>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<form name=&quot;form1&quot; method=&quot;Post&quot; action=&quot;insertmultiples2.asp&quot; onSubmit=&quot;return checkForm(this);&quot;>
<table width=&quot;400&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td width=&quot;118&quot;>Mission</td>
<td width=&quot;138&quot;>
<select name=&quot;MissionList&quot; size=&quot;1&quot;>
<%
Set objRst = Server.CreateObject(&quot;ADODB.recordset&quot;)
objRst.CursorLocation = 3
objRst.CursorType = 0
strQuery = &quot;SELECT mission, bomb_points FROM tblMissions ORDER BY mission&quot;
objRst.Open strQuery, strProvider
set objRst.ActiveConnection = Nothing
WHILE NOT objRst.EOF
%>
<option value=&quot;<%=objRst(&quot;bomb_points&quot;)%>&quot;><%=Trim(objRst(&quot;mission&quot;))%></option>
<%
objRst.MoveNext
WEND
set objRst = Nothing
%>
</select>
</td>
<td colspan=&quot;2&quot;>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Enter New Records&quot;>
</td>
</tr>
<tr>
<td width=&quot;118&quot;>
<div align=&quot;center&quot;>Callsign</div>
</td>
<td width=&quot;138&quot;>
<div align=&quot;center&quot;>Kills</div>
</td>
<td width=&quot;72&quot;>
<div align=&quot;center&quot;>Lived</div>
</td>
<td width=&quot;74&quot;>
<div align=&quot;center&quot;>Bombed</div>
</td>
</tr>
<%
Set objRst = Server.CreateObject(&quot;ADODB.recordset&quot;)
objRst.CursorLocation = 3
objRst.CursorType = 0
strQuery = &quot;SELECT callsign FROM tblPilots ORDER BY callsign&quot;
objRst.Open strQuery, strProvider
set objRst.ActiveConnection = Nothing

FOR i = 1 TO 8
%>
<tr>
<td width=&quot;118&quot;>
<select name=&quot;Callsign<%=i%>&quot;
<option value=&quot;&quot;>Select Pilot</option>
<%
objRst.MoveFirst
WHILE NOT objRst.EOF
%>
<option value=&quot;<%Trim(objRst(&quot;callsign&quot;))%>&quot;><%=Trim(objRst(&quot;callsign&quot;))%></option>
<%
objRst.MoveNext
WEND
%>
</select>
</td>
<td width=&quot;138&quot;>
<input type=&quot;text&quot; name=&quot;Kills<%=i%>&quot;>
</td>
<td width=&quot;72&quot;>
<select name=&quot;Lived<%=i%>&quot;>
<option value=&quot;10&quot;>Yes</option>
<option value=&quot;1&quot; selected>No</option>
</select>
</td>
<td width=&quot;74&quot;>
<select name=&quot;Bombed<%=i%>&quot;>
<option value=&quot;&quot;>Yes</option>
<option value=&quot;0&quot; selected>No</option>
</select>
</td>
</tr>
<%
NEXT
set objRst = Nothing
%>
</table>
<input type=&quot;hidden&quot; name=&quot;Mission&quot; value=&quot;&quot;>
</form>
</body>
</html>


ToddWW
 
Great !! I already pulled up the page. Don't panic if it came up blank in your screen. I viewed the source and I can tell that ASP rendered the page beautifully without any ASP errors. However, I missed a closing tag on one of the select objects.

It currently looks like this.

<select name=&quot;Callsign<%=i%>&quot;


I need you to add the end bracket so it will look like this.

<select name=&quot;Callsign<%=i%>&quot;>


ToddWW :)
 
yup i noticed the same thing - when viewed in source code it's all there,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top