mindfriction
07-22-2004, 02:40 PM
Ok, lets try again ;)
Cyanblue ive been working on the useability of the form and i just managed figure out how to get the tabIndex working properly, but how would i get the scrollpane component to scroll with the tabIndex? And also scroll to the first field detected to have invalid data? Could you please help/ give me a hint?
Here's a snippet of my script..
//instantiate tab index's
this._parent.tabEnabled=false;
this._parent.tabChildren=true;
firstName_txt.tabIndex=1;
lastName_txt.tabIndex=2;
street_txt.tabIndex=3;
suburb_txt.tabIndex=4;
postcode_txt.tabIndex=5;
state_txt.tabIndex=6;
contry_txt.tabIndex=7;
businessAreacode_txt.tabIndex=8;
businessPh_txt.tabIndex=9;
mobilePh_txt.tabIndex=10;
faxAreacode_txt.tabIndex=11;
faxPh_txt.tabIndex=12;
website_txt.tabIndex=13;
title_txt.tabIndex=14;
company_txt.tabIndex=15;
emailAddress_txt.tabIndex=16;
confirmEmailAddress_txt.tabIndex=17;
username_txt.tabIndex=18;
pass_txt.tabIndex=19;
confirmPass_txt.tabIndex=20;
question_txt.tabIndex=21;
answer_txt.tabIndex=22;
disagree_cmp.tabIndex=23;
agree_cmp.tabIndex=24;
submit_cmp.tabIndex=25;
reset_cmp.tabIndex=26;
Selection.setFocus("$firstName");
....
....
....
function processForm(component){
component.enabled=false;//disable submission button to stop accidental multiple submissions
required1_mc._visible = required2_mc._visible = required3_mc._visible = required4_mc._visible = required5_mc._visible = required6_mc._visible = required7_mc._visible = required8_mc._visible = required9_mc._visible = required10_mc._visible = required11_mc._visible = required12_mc._visible = required13_mc._visible = required14_mc._visible = required15_mc._visible = required16_mc._visible = required17_mc._visible = required18_mc._visible =false;
trace("processing form");
if((!$firstName.trim().length>0)
|| (!$lastName.trim().length>0)
|| (!$street.trim().length>0)
|| (!$suburb.trim().length>0)
|| (!$postcode.trim().length>0)
|| (!$state.trim().length>0)
|| (!$country.trim().length>0)
|| (!$businessAreacode.trim().length>0)
|| (!$businessPh.trim().length>0)
|| (!$title.trim().length>0)
|| (!$company.trim().length>0)
|| (($emailAddress.trim().isEmail() && confirmEmailAddress.trim().isEmail() && !($emailAddress.trim()==confirmEmailAddress.trim() )) || !$emailAddress.trim().isEmail() || !confirmEmailAddress.trim().isEmail())
|| (!$username.trim().length>0)
|| (($pass.trim().length>0 && confirmPass.trim().length>0 && !($pass.trim()==confirmPass.trim())) || !$pass.trim().length>0 || !confirmPass.trim().length>0)
|| (!$question.trim().length>0)
|| (!$answer.trim().length>0)){
if (!$firstName.trim().length>0){
trace("no first name");
required1_mc._visible=true;
}
if (!$lastName.trim().length>0){
trace("no last name");
required2_mc._visible=true;
}
if(!$street.trim().length>0){
trace("no street");
required3_mc._visible=true;
}
if(!$suburb.trim().length>0){
trace("no suburb");
required4_mc._visible=true;
}
if(!$postcode.trim().length>0){
trace("no postcode");
required5_mc._visible=true;
}
if(!$state.trim().length>0){
trace("no state");
required6_mc._visible=true;
}
if (!$country.trim().length>0){
trace("no country");
required7_mc._visible=true;
}
if (!$businessAreacode.trim().length>0) {
trace("no business areacode");
required8_mc._visible=true;
}
if (!$businessPh.trim().length>0) {
trace("no business ph");
required8_mc._visible=true;
}
if(!$title.trim().length>0) {
trace("no title");
required9_mc._visible=true;
}
if(!$company.trim().length>0) {
trace("no company");
required10_mc._visible=true;
}
if(($emailAddress.trim().isEmail() && confirmEmailAddress.trim().isEmail() && !($emailAddress.trim()==confirmEmailAddress.trim() )) || !$emailAddress.trim().isEmail() || !confirmEmailAddress.trim().isEmail()){
trace("no email");
required11_mc._visible=true;
required12_mc._visible=true;
}
if(!$username.trim().length>0){
trace("no username");
required13_mc._visible=true;
}
if(($pass.trim().length>0 && confirmPass.trim().length>0 && !($pass.trim()==confirmPass.trim())) || !$pass.trim().length>0 || !confirmPass.trim().length>0){
trace("bad pass");
required14_mc._visible=true;
required15_mc._visible=true;
}
if(!$question.trim().length>0){
trace("no question");
required16_mc._visible=true;
}
if(!$answer.trim().length>0){
trace("no answer");
required17_mc._visible=true;
}
this._parent._parent.openError("Please enter data correctly. Check fields denoted with arrows")
component.enabled=true;
}else if(agreementGroup.getValue()=="disagree"){
trace("user hasn't opt-in");
required18_mc._visible=true;
this._parent._parent.openError("You must accept on our terms and conditions as outlined at the bottom of this form to proceed");
component.enabled=true;
}else{
this._parent._parent.openStatus("submitting form please wait...", 2);
trace("All is Ok");
$recieveData = new LoadVars();
$sendData = new LoadVars();
$sendData.action="register";
$sendData.firstName=$firstName.trim();
$sendData.lastName=$lastName.trim();
$sendData.street=$street.trim();
$sendData.suburb=$suburb.trim();
$sendData.postcode=$postcode.trim();
$sendData.state=$state.trim();
$sendData.country=$country.trim();
$sendData.businessAreacode=$businessAreacode.trim( );
$sendData.businessPh=$businessPh.trim();
$sendData.mobilePh=$mobilePh.trim();
$sendData.title=$title.trim();
$sendData.faxAreacode=$faxAreacode.trim();
$sendData.faxPh=$faxPh.trim();
$sendData.company=$company.trim();
$sendData.website=$website.trim();
$sendData.emailAddress=$emailAddress1.trim();
$sendData.username=$username.trim();
$sendData.pass=$pass.trim();
$sendData.question=$question.trim();
$sendData.answer=$answer.trim();
$sendData.sendAndLoad("php/user.php",$recieveData,"POST");
$recieveData.onLoad = loadRegisterData;
}
};
Thanyou in advance
Cyanblue ive been working on the useability of the form and i just managed figure out how to get the tabIndex working properly, but how would i get the scrollpane component to scroll with the tabIndex? And also scroll to the first field detected to have invalid data? Could you please help/ give me a hint?
Here's a snippet of my script..
//instantiate tab index's
this._parent.tabEnabled=false;
this._parent.tabChildren=true;
firstName_txt.tabIndex=1;
lastName_txt.tabIndex=2;
street_txt.tabIndex=3;
suburb_txt.tabIndex=4;
postcode_txt.tabIndex=5;
state_txt.tabIndex=6;
contry_txt.tabIndex=7;
businessAreacode_txt.tabIndex=8;
businessPh_txt.tabIndex=9;
mobilePh_txt.tabIndex=10;
faxAreacode_txt.tabIndex=11;
faxPh_txt.tabIndex=12;
website_txt.tabIndex=13;
title_txt.tabIndex=14;
company_txt.tabIndex=15;
emailAddress_txt.tabIndex=16;
confirmEmailAddress_txt.tabIndex=17;
username_txt.tabIndex=18;
pass_txt.tabIndex=19;
confirmPass_txt.tabIndex=20;
question_txt.tabIndex=21;
answer_txt.tabIndex=22;
disagree_cmp.tabIndex=23;
agree_cmp.tabIndex=24;
submit_cmp.tabIndex=25;
reset_cmp.tabIndex=26;
Selection.setFocus("$firstName");
....
....
....
function processForm(component){
component.enabled=false;//disable submission button to stop accidental multiple submissions
required1_mc._visible = required2_mc._visible = required3_mc._visible = required4_mc._visible = required5_mc._visible = required6_mc._visible = required7_mc._visible = required8_mc._visible = required9_mc._visible = required10_mc._visible = required11_mc._visible = required12_mc._visible = required13_mc._visible = required14_mc._visible = required15_mc._visible = required16_mc._visible = required17_mc._visible = required18_mc._visible =false;
trace("processing form");
if((!$firstName.trim().length>0)
|| (!$lastName.trim().length>0)
|| (!$street.trim().length>0)
|| (!$suburb.trim().length>0)
|| (!$postcode.trim().length>0)
|| (!$state.trim().length>0)
|| (!$country.trim().length>0)
|| (!$businessAreacode.trim().length>0)
|| (!$businessPh.trim().length>0)
|| (!$title.trim().length>0)
|| (!$company.trim().length>0)
|| (($emailAddress.trim().isEmail() && confirmEmailAddress.trim().isEmail() && !($emailAddress.trim()==confirmEmailAddress.trim() )) || !$emailAddress.trim().isEmail() || !confirmEmailAddress.trim().isEmail())
|| (!$username.trim().length>0)
|| (($pass.trim().length>0 && confirmPass.trim().length>0 && !($pass.trim()==confirmPass.trim())) || !$pass.trim().length>0 || !confirmPass.trim().length>0)
|| (!$question.trim().length>0)
|| (!$answer.trim().length>0)){
if (!$firstName.trim().length>0){
trace("no first name");
required1_mc._visible=true;
}
if (!$lastName.trim().length>0){
trace("no last name");
required2_mc._visible=true;
}
if(!$street.trim().length>0){
trace("no street");
required3_mc._visible=true;
}
if(!$suburb.trim().length>0){
trace("no suburb");
required4_mc._visible=true;
}
if(!$postcode.trim().length>0){
trace("no postcode");
required5_mc._visible=true;
}
if(!$state.trim().length>0){
trace("no state");
required6_mc._visible=true;
}
if (!$country.trim().length>0){
trace("no country");
required7_mc._visible=true;
}
if (!$businessAreacode.trim().length>0) {
trace("no business areacode");
required8_mc._visible=true;
}
if (!$businessPh.trim().length>0) {
trace("no business ph");
required8_mc._visible=true;
}
if(!$title.trim().length>0) {
trace("no title");
required9_mc._visible=true;
}
if(!$company.trim().length>0) {
trace("no company");
required10_mc._visible=true;
}
if(($emailAddress.trim().isEmail() && confirmEmailAddress.trim().isEmail() && !($emailAddress.trim()==confirmEmailAddress.trim() )) || !$emailAddress.trim().isEmail() || !confirmEmailAddress.trim().isEmail()){
trace("no email");
required11_mc._visible=true;
required12_mc._visible=true;
}
if(!$username.trim().length>0){
trace("no username");
required13_mc._visible=true;
}
if(($pass.trim().length>0 && confirmPass.trim().length>0 && !($pass.trim()==confirmPass.trim())) || !$pass.trim().length>0 || !confirmPass.trim().length>0){
trace("bad pass");
required14_mc._visible=true;
required15_mc._visible=true;
}
if(!$question.trim().length>0){
trace("no question");
required16_mc._visible=true;
}
if(!$answer.trim().length>0){
trace("no answer");
required17_mc._visible=true;
}
this._parent._parent.openError("Please enter data correctly. Check fields denoted with arrows")
component.enabled=true;
}else if(agreementGroup.getValue()=="disagree"){
trace("user hasn't opt-in");
required18_mc._visible=true;
this._parent._parent.openError("You must accept on our terms and conditions as outlined at the bottom of this form to proceed");
component.enabled=true;
}else{
this._parent._parent.openStatus("submitting form please wait...", 2);
trace("All is Ok");
$recieveData = new LoadVars();
$sendData = new LoadVars();
$sendData.action="register";
$sendData.firstName=$firstName.trim();
$sendData.lastName=$lastName.trim();
$sendData.street=$street.trim();
$sendData.suburb=$suburb.trim();
$sendData.postcode=$postcode.trim();
$sendData.state=$state.trim();
$sendData.country=$country.trim();
$sendData.businessAreacode=$businessAreacode.trim( );
$sendData.businessPh=$businessPh.trim();
$sendData.mobilePh=$mobilePh.trim();
$sendData.title=$title.trim();
$sendData.faxAreacode=$faxAreacode.trim();
$sendData.faxPh=$faxPh.trim();
$sendData.company=$company.trim();
$sendData.website=$website.trim();
$sendData.emailAddress=$emailAddress1.trim();
$sendData.username=$username.trim();
$sendData.pass=$pass.trim();
$sendData.question=$question.trim();
$sendData.answer=$answer.trim();
$sendData.sendAndLoad("php/user.php",$recieveData,"POST");
$recieveData.onLoad = loadRegisterData;
}
};
Thanyou in advance