Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit button not functioning

Status
Not open for further replies.

electronicmonkey

Technical User
Feb 19, 2007
45
GB
I have a flash movie with a submit button which leads to another flash booking form book.swf . I am working in asp environment. My actionscript for the submit button is as follows :

on (release){

submitAttendees();

}


Somehow my scripts work fine on design machine , but the submit button goes dead on the live server. Anyone know what could be responsible ?




 
The function submitAttendees is defined in my booking as script which I reproduce below :

var startDate : Date = new Date(2007, 6, 16);
var now_date:Date = new Date();
if (startDate < now_date) {
startDate = now_date;
}

var summaryArray:Array = [];
var dateArray: Array = [];
var allowAdd : Boolean = true;
var noSportMsg : String = "You haven't selected any sports or dates from the calenders! Please add at least one date for at least one sport and then try again.";
var noNameMsg : String = "You must enter all the details for the child before you can continue. Please add the information and try again."
this.allowAdd = true;
_global.attendeeCount = 0;

// define loaders
var bookingParamsR:LoadVars = new LoadVars();
var bookingParamsC:LoadVars = new LoadVars();
var bookingParamsF:LoadVars = new LoadVars();
var submitBooking:LoadVars = new LoadVars();
calCricket.onDateClick = function(mc,eobj,robj){
//trace(_global.mServerURL + "?sysFlashAction=getTotalPerDay,getCricketersPerDay&queryDates=" + this.formatDate(mc.date, "YYYY-mm-dd"));
trace("day state=" + eobj.state);
if(eobj.state=="booked"){
theInfo="This date has been booked for another sport!"
return;
}
if(eobj.state=="full"){
theInfo="This date is fully booked!";
return;
}
if(eobj.value=="selected"){

if(getDayCount()>_global.mMaxNumberOfDays){

eobj.value="default";
eobj.setDayValue(mc.date, "");
theInfo = "You have booked the maximum number of days per child.";
return;
}
disableDate("football", mc.date);
disableDate("rugby", mc.date);
}
else{
enableDate("football", mc.date);
enableDate("rugby", mc.date);
}
bookingParamsC.load(_global.mServerURL + "?sysFlashAction=getTotalPerDay,getCricketersPerDay&queryDates=" + this.formatDate(mc.date, "YYYY-mm-dd"), this);
}

//rugby calander

calRugby.onDateClick = function(mc,eobj,robj){
//trace(_global.mServerURL + "?sysFlashAction=getTotalPerDay,getCricketersPerDay&queryDates=" + this.formatDate(mc.date, "YYYY-mm-dd"));
trace("day state=" + eobj.state);
if(eobj.state=="booked"){
theInfo="This date has been booked for another sport!"
return;
}
if(eobj.state=="full"){
theInfo="This date is fully booked!";
return;
}
if(eobj.value=="selected"){

if(getDayCount()>_global.mMaxNumberOfDays){

eobj.value="default";
eobj.setDayValue(mc.date, "");
theInfo = "You have booked the maximum number of days per child.";
return;
}
disableDate("cricket", mc.date);
disableDate("football", mc.date);
}
else{
enableDate("cricket", mc.date);
enableDate("football", mc.date);
}
trace(_global.mServerURL + "?sysFlashAction=getTotalPerDay,getRugbyPerDay&queryDates=" + this.formatDate(mc.date, "YYYY-mm-dd"));
bookingParamsR.load(_global.mServerURL + "?sysFlashAction=getTotalPerDay,getRugbyPerDay&queryDates=" + this.formatDate(mc.date, "YYYY-mm-dd"), this);
}
// football caladner
calFootball.onDateClick = function(mc,eobj,robj){
//trace(_global.mServerURL + "?sysFlashAction=getTotalPerDay,getCricketersPerDay&queryDates=" + this.formatDate(mc.date, "YYYY-mm-dd"));
trace("football day state=" + eobj.state);
if(eobj.state=="booked"){
theInfo="This date has been booked for another sport!"
return;
}
if(eobj.state=="full"){
theInfo="This date is fully booked!";
return;
}
if(eobj.value=="selected"){

if(getDayCount()>_global.mMaxNumberOfDays){

eobj.value="default";
eobj.setDayValue(mc.date, "");
theInfo = "You have booked the maximum number of days per child.";
return;
}
disableDate("cricket", mc.date);
disableDate("rugby", mc.date);
}
else{
enableDate("cricket", mc.date);
enableDate("rugby", mc.date);
}
bookingParamsF.load(_global.mServerURL + "?sysFlashAction=getTotalPerDay,getFootballersPerDay&queryDates=" + this.formatDate(mc.date, "YYYY-mm-dd"), this);
}


bookingParamsC.onLoad = function(success:Boolean) {
if (success) {

if (this.refresh) {
//calCricket.setXML("CBookingDates.xml");
}
if(this.totals<_global.mChildrenPerDay+1){
// not over subscribed so date ok

}
else{
disableDate("all", this.selectedDate);
}
trace((this.countCricket<_global.mCricketersPerDay+1));
if (this.countCricket<_global.mCricketersPerDay+1){
// ok add to attendee.
_global.currentAttendee.sportDetail = addSportSummary();
_global.currentAttendee.sportData = addSportData();
if(_global.currentAttendee.sportData){
allowAdd = true;
}
}
else{
disableDate("cricket", this.selectedDate);
}
}
else {
trace("Error loading/parsing LoadVars.");
}
};

bookingParamsF.onLoad = function(success:Boolean) {
if (success) {

if (this.refresh) {
//calFootball.setXML("FBookingDates.xml");
}
if(this.totals<_global.mChildrenPerDay+1){
// not over subscribed so date ok

}
else{
disableDate("all", this.selectedDate);
}
trace((this.countFootball<_global.mFootballersPerDay+1));
if (this.countFootball<_global.mFootballersPerDay+1){
// ok add to attendee.
_global.currentAttendee.sportDetail = addSportSummary();
_global.currentAttendee.sportData = addSportData();
if(_global.currentAttendee.sportData){
allowAdd = true;
}
}
else{
disableDate("football", this.selectedDate);
}
}
else {
trace("Error loading/parsing LoadVars.");
}
};

bookingParamsR.onLoad = function(success:Boolean) {
if (success) {
trace("rugby loaded " + success);
if (this.refresh) {
//calRugby.setXML("RBookingDates.xml");
}
if(this.totals<_global.mChildrenPerDay+1){
// not over subscribed so date ok

}
else{
disableDate("all", this.selectedDate);
}
trace((this.countRugby<_global.mRugbyPersPerDay+1));
if (this.countRugby<_global.mRugbyPerDay+1){
// ok add to attendee.
_global.currentAttendee.sportDetail = addSportSummary();
_global.currentAttendee.sportData = addSportData();
if(_global.currentAttendee.sportData){
allowAdd = true;
}
}
else{
disableDate("rugby", this.selectedDate);
}
}
else {
trace("Error loading/parsing LoadVars.");
}
};

// init calanders

bookingParamsC.load(_global.mServerURL + "?sysFlashAction=loadxml&ctype=C", this);
bookingParamsF.load(_global.mServerURL + "?sysFlashAction=loadxml&ctype=F", this);
bookingParamsR.load(_global.mServerURL + "?sysFlashAction=loadxml&ctype=R", this);
// functions



function getNiceDate(theDate:Date):String {
return theDate.getDate() + "-" + getMonthAsString(theDate.getMonth()) + "-" + theDate.getFullYear();
}

function getMonthAsString(month:Number):String {
var monthNames_array:Array = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
return monthNames_array[month];
}

disableDate = function(theType, theDate){
trace("disbableDate");
if(theType=="all"){
calCricket.setDayState(theDate, "booked");
calFootball.setDayState(theDate, "booked");
calRugby.setDayState(theDate, "booked");
}
if(theType=="cricket"){

trace(calCricket.setDayState(theDate, "booked"));

}
if(theType=="football"){

calFootball.setDayState(theDate, "booked");
}
if(theType=="rugby"){
calRugby.setDayState(theDate, "booked");
}
}
enableDate = function(theType, theDate){

var cricketEvents = calCricket.getEvent(theDate);
var rugbyEvents = calRugby.getEvent(theDate);
var footballEvents = calFootball.getEvent(theDate);
trace("football state=" + footballEvents.state);

if(theType=="all"){
calCricket.setDayState(theDate, "");
calFootball.setDayState(theDate, "");
calRugby.setDayState(theDate, "");
}
if(theType=="cricket"){
calCricket.setDayState(theDate, "");
}
if(theType=="football"){
calFootball.setDayState(theDate, "");
}
if(theType=="rugby"){
calRugby.setDayState(theDate, "");
}
}
addSportSummary = function(){
var s = "";

if (calCricket.getSelected().length>0){
s = "Cricket - " + calCricket.getSelected("dd/mm").join(", ") + "\n";
}
if (calRugby.getSelected().length){
s = s + "Rugby - " + calRugby.getSelected("dd/mm").join(", ")+ "\n";
}
if (calFootball.getSelected().length){
s = s + "Football - " + calFootball.getSelected("dd/mm").join(", ")+ "\n";
}
return s;
}
getDayCount = function(){
trace("getDayCount");
trace(calCricket.getSelected().length + calRugby.getSelected().length + calFootball.getSelected().length);
return calCricket.getSelected().length + calRugby.getSelected().length + calFootball.getSelected().length;

}
addSportData = function(){
var s = "";

if (calCricket.getSelected().length>0){
s = "Cricket:" + calCricket.getSelected("YYYY-mm-dd").join(",") + ";" ;
}
if (calRugby.getSelected().length){
s = s + "Rugby:" + calRugby.getSelected("YYYY-mm-dd").join(",") + ";" ;
}
if (calFootball.getSelected().length){
s = s + "Football:" + calFootball.getSelected("YYYY-mm-dd").join(",") + ";" ;
}
return s;
}

addNewAttendee=function(){

// clear fields
//this.currentAttendee = eval("this.summaryPanel.attendee" + _global.attendeeCount );
//_global.attendeeCount++
//return
if(_global.attendee.length==_global.mMaxChildrenPerBooking){
theInfo = "You have reached the maximum number of children for this booking."
allowAdd = false;
btnAddChild._visible=false;
return;
}

tblAttendee_FirstName.text ="" ;
tblAttendee_Surname.text ="";
tblAttendee_Age.selectedIndex=0;
tblAttendee_Gender.selectedIndex=0;
calFootball.setXML("Fbookingdates.xml");
calCricket.setXML("Cbookingdates.xml");
calRugby.setXML("Rbookingdates.xml");

summary = this.summaryPanel.attachMovie("movAttendee", "summary" + _global.attendeeCount, this.summaryPanel.getNextHighestDepth(),{firstName:"", Surname:"", Age:"", Gender:"",editing:true,index:_global.attendeeCount})
summary.attendeeDetail = summary.firstName + " " + summary.Surname;
summary.click=function(){
trace(this);
this.editing=true;
this.borderColor=0xCC3333;
}
if(_global.attendeeCount ==0 ){
//summary.btnDelete._visible=false;
}
summary._x = this.summaryPanel._x;
summary._y = _global.attendee.length * summary._height ;
//summary.sportDetail = this.addSportSummary();
_global.attendee.push(summary);
trace("add new and now attendee is " + _global.attendee.length);
_global.currentAttendee=summary;

_global.attendeeCount++

allowAdd = true;
}
makeEditable=function(obj){
trace (obj);
}
setAttendeeDetail = function(){

return tblAttendee_FirstName.text + " " + tblAttendee_Surname.text;

}
reposSummary = function(){
trace("respositioning");
for(var i=0;i<_global.attendee.length;i++){
trace("move " + _global.attendee + " to " + (i * _global.attendee._height) );
_global.attendee._y = i * _global.attendee._height ;
}
}
isComplete = function(){
for(i=0;i<_global.attendee.length;i++){
trace(i + "firstname=" + _global.attendee.Age);
if((_global.attendee.firstName!="") && (_global.attendee.Surname!="") && (_global.attendee.Age!="") && (_global.attendee.Gender!="") && (_global.attendee.sportData) ){

}
else{
trace(i + " is not complete");
return false;
}
}
return true;
}
getBookingData = function(){
var s = '';
for(i=0;i<_global.attendee.length;i++){
if(_global.attendee.sportData){
s = s + "FirstName:" + _global.attendee.firstName + ";Surname:" + _global.attendee.Surname + ";Age:" + _global.attendee.Age + ";Gender:" + _global.attendee.Gender + ";" + _global.attendee.sportData + "|";
}
}
return s;
}
submitAttendees = function(){
if(chkTOC.selected){
if (isComplete()){
/// submit dates
trace(getBookingData() );
submitBooking.load(_global.mServerURL + "?sysFlashAction=commitbookings&sysID=" + _global.parentId + "&thedata=" + getBookingData(), this);
}
else{
theInfo = "Please make sure all the attendee details are correct."
}
}
else{
theInfo = "Please aggree to the Terms and Conditions by ticking the box."
chkTOC.setFocus();
}

}

submitBooking.onLoad = function(success:Boolean) {
if (success) {
trace("rstatus " + this.rstatus);
if(this.rstatus && this.cstatus && this.fstatus){
_parent.gotoAndPlay("book_stage4");
theInfo = "Order Complete Booking Ref = BSC" + _global.parentId
}
}
else {
trace("Error loading/parsing LoadVars.");
}
};

 
The required function "submitAttendees " is contained inside an actionscript file "booking.as"
What I would like to know is if my syntax for calling the function (through a submit button) is right or wrong.Here it is again :

on (release){

submitAttendees();

}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top