If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > help with java-asp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-04, 17:37
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Question 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
Reply With Quote
  #2 (permalink)  
Old 11-02-04, 18:21
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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;
}
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On