Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    183

    Question Unanswered: help with java-asp

    function cmdNext_click() {

    var szRedirect = ""
    var nCount
    if (window.myForm.AccommodationGroup.value == '' || window.myForm.AccommodationGroup.value == '0')
    {
    window.alert('You must select a Company group before you continue.');
    window.myForm.AccommodationGroup.focus();
    return;
    }


    szRedirect = szRedirect + "&NUMBEROFAPARTMENTS=" + window.myForm.NumberOfApartments.value;
    szRedirect = szRedirect + "&CBD=" + window.myForm.DistToCBD.value;
    szRedirect = szRedirect + "&BEACH=" + window.myForm.DistToBeach.value;
    szRedirect = szRedirect + "&AIRPORT=" + window.myForm.DistToAirport.value;
    szRedirect = szRedirect + "&RATING=" + window.myForm.StarRating.value;
    szRedirect = szRedirect + "&HOURS=" + window.myForm.ReceptionHours.value;
    szRedirect = szRedirect + "&CommissionRate=" + escape(window.myForm.CommissionRate.value);
    szRedirect = szRedirect + "&Currency=" + escape(window.myForm.Currency.value);
    szRedirect = szRedirect + "&PropertyCommission=" + window.myForm.PropertyCommission.value;
    szRedirect = szRedirect + "&TSNSupplier=" + escape(window.myForm.TSNSupplier.value);
    szRedirect = szRedirect + "&Commissionable=" + escape(window.myForm.Commissionable.value);
    szRedirect = szRedirect + "&AccommodationGroup=" + escape(window.myForm.AccommodationGroup.value);

    // Navigate to the save page.
    window.location.href = "SavePropertyDetails.asp" + document.location.search + szRedirect;
    }

    This is basically a javascript function we use to save values, I would like to change this function so it asks users to enter CommissionRate and Currency if value in field Commissionable is 'Yes'

    so Commissionable 'yes' enter commission rate.

    I have tried something like this

    if (window.thisForm.Commissionable.options(window.thi sForm.Commissionable.selectedIndex).text == 'Yes' &&
    window.thisForm.CommissionRate.value == ' ' )
    {
    window.alert("You must enter commission rate if field is commissionable.");
    return;
    }

    but has no affect, i can leave these fields empty and submit without being prompted to do so.

    Thanks and regards

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    add this to your javascript so you can see why it is failing...
    Code:
    alert(window.thisForm.Commissionable.options(window.thi sForm.Commissionable.selectedIndex).text);
    alert(window.thisForm.CommissionRate.value);
    if (window.thisForm.Commissionable.options(window.thi sForm.Commissionable.selectedIndex).text == 'Yes' &&
    window.thisForm.CommissionRate.value == ' ' )
    {
    window.alert("You must enter commission rate if field is commissionable.");
    return;
    }

Posting Permissions

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