Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-10-2004, 01:07 PM   #1
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
JavaScript & PHP

Hi Guys I would like some on help on this form.

Hi I have the following function and It currently doesnt ask me for fill the blank field TeamName, What could be wrong?

Thanks a lot.
PHP Code:

function GetUserPredictions($user$Team$Copa$Nombre,$Equipo,$NombreEquipo,$Division) {

$link OpenConnection();
    if (
$link == FALSE) {
"Unable to connect to the dbase";

"<form action=\"Ingresar-Apuesta.php\" method=\"POST\">";
"<td  class=\"TBLROWER\"><font class=\"TBLROW\">$datestr $timestr</font></td>";
"<input type=\"text\" name=\"TeamName\" value=\"$NombreEquipo\" >";

"<input type=\"submit\" onSubmit=\"checkEquipo(this.form);\"name=\"Submit\" value=\"Submit\"></td>";

checkEquipo(form) {
    if (
form.TeamName.value == "") {
alert("Fill the form");
    return (

Last edited by Gerardoj; 06-10-2004 at 01:08 PM.
Old 06-11-2004, 01:02 AM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

There are a couple of problems here:
1. I'd declare the javascript function *before* I use it.
2. Since you're initializing the text value with "$NombreEquipo", it might not be blank
... but the real problem is ...
3. Your onSubmit() method needs to go in the *form* tag (not "input type=submit").
<script language="JavaScript">
  function checkEquipo (f) {
    if (f.TeamName.value == "" || f.TeamName.value == null) {
      alert ("value empty!");
    else {
      alert ("value= " + f.TeamName.value);
      return (true);
<form method="POST" onSubmit="checkEquipo (this);">
<table border="0">
  <td><input type="text" name="TeamName" value="0"></td></tr>
  <td colspan="2">
  <input type="submit" name="Submit" value="Submit"></td></tr>
'Hope that helps .. PSM


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP,JAVASCRIPT and CheckBox aznita Programming 2 06-17-2005 05:33 AM
Can I use PHP variables in javascript? nickiv Programming 1 06-07-2005 06:41 AM
Arrays, checkboxes in javascript & PHP Elijah Programming 21 11-16-2004 12:37 AM
PHP and JavaScript Gerardoj Programming 4 04-22-2004 03:02 PM
PHP and or Javascript Can they be used the same way? ElementNine Programming 1 03-05-2004 09:22 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration