Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    field testing for blank

    How would I change the following two lines to test the first field to see if it is blank and if it is not - to then test the second field to make sure it is not blank. If the first field isn't blank and the second field is blank then I need to output an error.

    if ( objForm.form_transaction_forward.value == 'Correction' )
    {
    if (!chkNotNull(objForm.form_forward_date, 'text', 'You must enter your comments')) return false;
    }
    else
    return true;

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    i'm not quite sure i understood that. could you explain it again? also, it's much easier to help out, if we can see all the code; could you link to the page this would be on?
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New Coder
    Join Date
    Feb 2003
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The following is my error checking code. I need to add an additional field check to this. I have a field called "form_forward_email_name". I need to test this field to see if it is blank. If it is - no more testing is required. If it is not blank, I then need to test another field called "form_forward_end_date". This field cannot be blank if the first field called "form_forward_email_name" is not blank. Basically if one of these fields has data in it, then the other one must have data in it.

    <!--
    function frmCheck (objForm){
    if (!chkNotNull(objForm.form_employee_first_name, 'text', 'You must enter the employee first name')) return false;
    if (!chkNotNull(objForm.form_employee_last_name, 'text', 'You must enter the employee last name')) return false;
    if (!chkNotNull(objForm.form_requestor, 'text', 'You must enter your name')) return false;
    if (!chkNotNull(objForm.form_manager_name, 'text', 'You must enter the manager name')) return false;
    if (!chkNotNull(objForm.form_department_account, 'text', 'You must enter the department account number')) return false;
    if (!chkNotNull(objForm.form_HR_representative, 'text', 'You must enter the HR representative name')) return false;
    if (!chkNotNull(objForm.form_transaction_type, 'select', 'You must enter the transaction type')) return false;
    if (!chkNotNull(objForm.form_employee_location, 'select', 'You must enter the location')) return false;
    if (!chkNotNull(objForm.form_pctype, 'select', 'You must enter type of PC')) return false;
    if (!chkNotNull(objForm.form_requestor_email, 'select', 'You must enter your email address')) return false;

    if ( objForm.form_transaction_type.value == 'Correction' )
    {
    if (!chkNotNull(objForm.form_comments, 'text', 'You must enter your comments')) return false;
    }
    else
    return true;
    }
    // -->


    Thanks for responding.

  • #4
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    All the negatives are blowing my mind (if not not null, return false) and I can't see the code for chkNotNull() so I might reverse the logic on one of these. That's easy enough for you to switch around though. Just add this line in right below the if statement you have for the email address (form_requestor_email).

    if ((!chkNotNull(objForm.form_forward_email_name, 'text', 'You must enter your email name'))&&(!chkNotNull(objForm.form_forward_email_name, 'text', 'You must enter your email name'))) return false;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •