Help 
Author Message
 Help

Hi i need help finding a script for a form where people can type in... let's
say baby's names,  then,  when clicking on submit....it would add it
automaticly  to a result page. Thank you!

--
Yann ( A.K.A. EC932 )

http://www.*-*-*.com/



Sat, 28 Aug 2004 00:00:10 GMT  
 Help
<html>
<head>
<script language="javascript">
var  i=1;
var j;
var Order='Order';
var isUpdate;
var OrderArray = new Array();
window.onload = function Load()
{
    document.myform.firstText.value = '';
    document.myform.firstText.focus();
Quote:
}

function ClearReport()
{
  document.myform.myarea.value = '';
  document.myform.firstText.focus();
Quote:
}

function ok()
{
  if(document.myform.firstText.value.length == 0)
  {
    alert('please enter in a name');
    return false;
  }
  else
  {

    isUpdate = false;
    for(j=1; j<=(i+2); j++)
//i+2 becuase there are four elements in the page before
the inut boxes
    {
        var name = 'Order' + j;
        if(GetHTMLByID(name))
        {
          if(isSameValue(name))
          {
                    UpdateInputValue(name);
                        document.myform.firstText.value
= '';
                        document.myform.firstText.focus();
            isUpdate = true;
          }
        }
    }
    if(!isUpdate)
    {
      AddInput('tbody', i);
      i+=1;
      document.myform.firstText.value = '';
      document.myform.firstText.focus();
    }
    return true;
  }

Quote:
}

function AddInput(tBody, index)
{
  var tTR = null;
  var tTD = null;

  tBody = GetTag(tBody);

  tTR = document.createElement('tr');
  tTD = document.createElement('td');
    tTD.colSpan = 2;
    tTD.align = 'left';
        tInner1 = document.createElement('input');
        tInner1.type = 'text';
        tInner1.id = Order + i;
        tInner1.name = Order + i;
        tInner1.value = document.myform.firstText.value;
        tInner1.onfocus = function(){UpdateOder
(this.value);}
    tTD.appendChild(tInner1);
  tTR.appendChild(tTD);
  tBody.appendChild(tTR);

Quote:
}

function UpdateOder(inputvalue)
{
  OrderArray[0] = inputvalue;
  document.myform.firstText.value = inputvalue;
  document.myform.firstText.focus();
Quote:
}

function GetTag(tag)
{
  if(((typeof tag) != 'string') && ((typeof tag) !
= 'number'))
  {
    return tag;
  }
  else if(document.getElementById(tag) != null)
  {
    return document.getElementById(tag);
  }
return null;

Quote:
}

function GetHTMLByID(id)
{
  return document.getElementById(id);

Quote:
}

function isSameValue(InputField)
{
  if ((OrderArray[0]) == (document.myform
[InputField].value))
  {
    return true;
  }
  else
  {
    return false;
  }
Quote:
}

function UpdateInputValue(OrderInput)
{
        document.myform[OrderInput].value =
document.myform.firstText.value;
Quote:
}

</script>
</head>
<body>
<form name="myform">
  <table border="1" cellspacing="0" cellpadding="0">
  <tr>
     <td colspan="2" align="center">
        Baby name :<input type="text" name="firstText"
value="" /></td>
  </tr>
  <tr>
    <td colspan="2" align="center">
       <input type="BUTTON" value="Add Name"
onclick="javascript:ok();" />
    </td>
  </tr>
  <tr>
     <td colspan="2" align="left">Baby Name </td>
  </tr>
  <tbody id="tbody"></tbody>
</table>
</form>
</body>
</html>


Sat, 28 Aug 2004 03:26:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. help help help help help

2. Guru required - Help, Help, Help - ASP and SCRIPT

3. Help Help Help...thanks

4. PLEASE HELP PLEASE HELP PLEASE HELP

5. Help Help Help with Subst and Scheduler

6. HELP HELP HELP ACCESS 97

7. Someone Please Help Me - I Help You in Any Software Queries/Programming/Coding

8. HELP uncheck the radio button!!, HELP!

9. help help document.body.height ^^????!!!

10. HELP: Need help with drop down menu's

11. Help Help needed Opening Outlook Contacts(public) in VB5

12. Need help - Help please!

 

 
Powered by phpBB® Forum Software