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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update other values - New to web

Status
Not open for further replies.

SkiCheif

Technical User
Sep 8, 2004
30
US
I need to test a users entry and then update the textbox they were in based on an extra input from them.

I think the easiest way for me to describe it is to write psuedo vba code (which i'm more comfortable with)

Background:
User is entering in results from a wrestling match. If the value is numeric, then the match was decided on points. However, if there the wrestler was pinned or won by a technical fall then I want to ask them for the time of the match and add that to the combo box selection they made.

Form Control Name: cboHomeMatchScore

(also, I am use to 'lost focus' instead of 'blur'
----------------------------------------------------
Dim strUserEntry as String
Dim strCurrent as String

strCurrent = cboHomeMatchScore

[cboHomeMatchScore.LostFocus Event]

If Not IsNumeric(cboHomeMatchScore) then

strUserEntry = InputBox("Please Enter the time in this format '00:00'")

cboHomeMatchScore = strCurrent & " " & strUserEntry

Else

'do nothing here

End If

------------------------------------------------------

Goal:
To test the users input to see if there are points scored or the event ended in a 'timed manner'

Concantenate the result if not numeric with the user entered time

FOR EXAMPLE

Win By Fall 01:30

What I acutally need to do is much more complicated than this example.
If I can get this to work, then I would like to shoot for the moon.
When a wrestler wins the match, there are team points awarded to both wrestlers in a tier based on how well they won or lost [decision, major, tech fall, pin], AND they are awarded seed points based on the same criteria.

I was able to accomplish all of this in Access, but this looks like a much more daunting task.

I have been playing with this for about two weeks trying to figure it out on my own. I also had another problem that with the help of Tarwin I was able to overcome.

Thanks For Your Help
 
Here is the javascript equivalent of your vb:


In the head:
Code:
<script type="text/javascript">
<!-- hide

function concatTime()
{
  var form = window.document.myform; //change to your form
  var matchScore = form.matchScore; //change to your input name

  if (matchScore.value.match(/^\D*$/))
  {
    var time = prompt("Please Enter the time in this format '00:00'","");
    matchScore.value += " " + time;
  }
  else
  {
    // do nothing
  }
}

// -->
</script>
And in your form, have:
Code:
<!-- Change to your tag names -->
<form name="myform">
<input type="text" name="matchScore" [b]onChange="concatTime();">
</form

--Chessbot

The program didn't do anything wrong; it did exactly what you told it to!
 
Thanks for your quick response. Can you comment on a couple of questions so that I can understand and not just follow your example blindly.

I understand all of it but two things:

if (matchScore.value.match(/^\D*$/))

Does -- match(/^\D*$/) -- translate to not numeric?

Also, what does the mean in this: onChange="concatTime();">

Thanks Again
 
--> I was trying to bold it in TGML but forgot the end tag ;-)

match(/^\D$*/) --> This checks that the variable is in the format ^\D*$. Check out a RE (Regular Expressions) tutorial for more information, but here:

^ means beginning of string
\D means anything not a digit
* means 0 or more of these
$ means end of string

So if the string consistes of only:
beginning, 0 or more non-digits, end

--Chessbot

The program didn't do anything wrong; it did exactly what you told it to!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top