Last Try... Logic Problems 
Author Message
 Last Try... Logic Problems

I have an HTML form under IE with the following input fields: BHN, ENG and
OAN
I am using VBScript to handle the error checking of the form fields.
Any combination of the form fields must be filled out... BHN or ENG or OAN
.
.
.
<BEGIN HTML FORM>
<form name="QB">
  <table>
    <tr>
      <td align="left" valign="middle">
        BHN:
      </td>
      <td align="left" valign="middle">
        <input type="text" name="BHN">
      </td>          
      <td align="left" valign="middle">
        ENG:
      </td>
      <td align="left" valign="middle">
        <input type="text" name="ENG">
      </td>
      <td align="left" valign="middle">
        OAN:
      </td>
      <td align="left" valign="middle">
        <input type="text" name="OAN">
      </td>          
    </tr>
  </table>
</form>
<END HTML FORM>
.
.
.
In the following script, I have outlined my logic statements. I am checking
the length of each input field. If the length is equal to or less than 0,
present the user with an Alert window. I wish to do this for any combination
of BHN, ENG or OAN, however, thus far, using the logic statements (as
outlined below) do not generate the desired Alert window.
.
.
.
<BEGIN VBScript LOGIC>
Dim fld
Function fnSend
Set fld = document.QB
If (Len(fld.BHN.Value) <= 0 And Len(fld.ENG.Value) <= 0 And
Len(fld.OAN.Value) <= 0) Then
  Alert "The BHN, ENG, or the OAN Field is required."
  Set fld.BHN.Value = ""
  Set fld.ENG.Value = ""
  Set fld.OAN.Value = ""
end if
End Function
<END VBScript LOGIC>
.
.
.
However, if I evaluate only 1 field, it works fine...
(see the following code sample)...
.
.
.
<BEGIN VBScript LOGIC>
Dim fld
Function fnSend
Set fld = document.QB
If Len(fld.BHN.Value) <= 0 Then
  Alert "The BHN Field is required."
  Set fld.BHN.Value = ""
end if
End Function
<END VBScript LOGIC>
.
.
.
Anyone care to assist? It would be greatly appreciated...
.
.
.
Thanks,

Caine



Wed, 28 Jul 2004 04:46:32 GMT  
 Last Try... Logic Problems
If you want all fields to be filled you should be 'OR' ing the length
checks.
Joe

Quote:
> I have an HTML form under IE with the following input fields: BHN, ENG and
> OAN
> I am using VBScript to handle the error checking of the form fields.
> Any combination of the form fields must be filled out... BHN or ENG or OAN
> .
> .
> .
> <BEGIN HTML FORM>
> <form name="QB">
>   <table>
>     <tr>
>       <td align="left" valign="middle">
>         BHN:
>       </td>
>       <td align="left" valign="middle">
>         <input type="text" name="BHN">
>       </td>
>       <td align="left" valign="middle">
>         ENG:
>       </td>
>       <td align="left" valign="middle">
>         <input type="text" name="ENG">
>       </td>
>       <td align="left" valign="middle">
>         OAN:
>       </td>
>       <td align="left" valign="middle">
>         <input type="text" name="OAN">
>       </td>
>     </tr>
>   </table>
> </form>
> <END HTML FORM>
> .
> .
> .
> In the following script, I have outlined my logic statements. I am
checking
> the length of each input field. If the length is equal to or less than 0,
> present the user with an Alert window. I wish to do this for any
combination
> of BHN, ENG or OAN, however, thus far, using the logic statements (as
> outlined below) do not generate the desired Alert window.
> .
> .
> .
> <BEGIN VBScript LOGIC>
> Dim fld
> Function fnSend
> Set fld = document.QB
> If (Len(fld.BHN.Value) <= 0 And Len(fld.ENG.Value) <= 0 And
> Len(fld.OAN.Value) <= 0) Then
>   Alert "The BHN, ENG, or the OAN Field is required."
>   Set fld.BHN.Value = ""
>   Set fld.ENG.Value = ""
>   Set fld.OAN.Value = ""
> end if
> End Function
> <END VBScript LOGIC>
> .
> .
> .
> However, if I evaluate only 1 field, it works fine...
> (see the following code sample)...
> .
> .
> .
> <BEGIN VBScript LOGIC>
> Dim fld
> Function fnSend
> Set fld = document.QB
> If Len(fld.BHN.Value) <= 0 Then
>   Alert "The BHN Field is required."
>   Set fld.BHN.Value = ""
> end if
> End Function
> <END VBScript LOGIC>
> .
> .
> .
> Anyone care to assist? It would be greatly appreciated...
> .
> .
> .
> Thanks,

> Caine




Thu, 29 Jul 2004 02:57:27 GMT  
 Last Try... Logic Problems
Did you try ...

If (Len(fld.BHN.Value) + Len(fld.ENG.Value) + Len(fld.OAN.Value)) <= 0 Then

Bill Wallace


Quote:
> I have an HTML form under IE with the following input fields: BHN, ENG and
> OAN
> I am using VBScript to handle the error checking of the form fields.
> Any combination of the form fields must be filled out... BHN or ENG or OAN
> .
> .
> .
> <BEGIN HTML FORM>
> <form name="QB">
>   <table>
>     <tr>
>       <td align="left" valign="middle">
>         BHN:
>       </td>
>       <td align="left" valign="middle">
>         <input type="text" name="BHN">
>       </td>
>       <td align="left" valign="middle">
>         ENG:
>       </td>
>       <td align="left" valign="middle">
>         <input type="text" name="ENG">
>       </td>
>       <td align="left" valign="middle">
>         OAN:
>       </td>
>       <td align="left" valign="middle">
>         <input type="text" name="OAN">
>       </td>
>     </tr>
>   </table>
> </form>
> <END HTML FORM>
> .
> .
> .
> In the following script, I have outlined my logic statements. I am
checking
> the length of each input field. If the length is equal to or less than 0,
> present the user with an Alert window. I wish to do this for any
combination
> of BHN, ENG or OAN, however, thus far, using the logic statements (as
> outlined below) do not generate the desired Alert window.
> .
> .
> .
> <BEGIN VBScript LOGIC>
> Dim fld
> Function fnSend
> Set fld = document.QB
> If (Len(fld.BHN.Value) <= 0 And Len(fld.ENG.Value) <= 0 And
> Len(fld.OAN.Value) <= 0) Then
>   Alert "The BHN, ENG, or the OAN Field is required."
>   Set fld.BHN.Value = ""
>   Set fld.ENG.Value = ""
>   Set fld.OAN.Value = ""
> end if
> End Function
> <END VBScript LOGIC>
> .
> .
> .
> However, if I evaluate only 1 field, it works fine...
> (see the following code sample)...
> .
> .
> .
> <BEGIN VBScript LOGIC>
> Dim fld
> Function fnSend
> Set fld = document.QB
> If Len(fld.BHN.Value) <= 0 Then
>   Alert "The BHN Field is required."
>   Set fld.BHN.Value = ""
> end if
> End Function
> <END VBScript LOGIC>
> .
> .
> .
> Anyone care to assist? It would be greatly appreciated...
> .
> .
> .
> Thanks,

> Caine




Sat, 31 Jul 2004 09:34:21 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Last Try... Logic Problems

2. Display Image Type from MS SQL

3. Delphi:Way to access main forms variables?

4. Last try for stored procedures/ODBC problem...

5. Excel to Access, last try.

6. One last try....

7. My last try

8. Trying to retrieve the last line from a textbox

9. One last try to get the correct attached file

10. type casting (objects)

11. TechTips: Is "third normal form" really best?

12. With BPW 7.0, how to Exec another program?

 

 
Powered by phpBB® Forum Software