Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Element Dependency
cshanek
Junior Member

Posts: 4
Registered: 8/31/2005
Location: San Antonio
Member Is Offline
posted on 8/31/2005 at 07:41 PM Reply With Quote
Element Dependency


Greetings,

As always I am impressed with your work. One thing I was thinking about however were cases which require a form object to possess some sort of property depending on the value of another form object.

For instance, I have several cases where I would like to have "if (this.dropdown.options[this.dropdown.selectedIndex].text == 'myparam' && !this.dependentfield.value) then output generic alert.
I looked at your m key for ideas, but since I am inept at javascript I failed miserably.

I appreciate your help,
View User's Profile View All Posts By User U2U Member
cshanek
Junior Member

Posts: 4
Registered: 8/31/2005
Location: San Antonio
Member Is Offline
posted on 8/31/2005 at 07:58 PM Reply With Quote
:(


I just read the Defining Dependencies post to the Tigra Form Validator Pro forum. Apparently there are too many possibilities to code dependencies into this script.
View User's Profile View All Posts By User U2U Member
cshanek
Junior Member

Posts: 4
Registered: 8/31/2005
Location: San Antonio
Member Is Offline
posted on 8/31/2005 at 08:23 PM Reply With Quote
Sorry I keep replying to myself..


It seems as though accomodations could be made to the following code....// check reqired fields
if (this.a_fields[n_key]['r'] && !this.a_fields[n_key]['v']) {
this.a_fields[n_key].n_error = 1;
n_errors_count++;
}

to allow for something like...
'dependent':{'l':Dependent', 'r':true if form.dependee, 'f':'Dependent'}

What do you think?
View User's Profile View All Posts By User U2U Member
cshanek
Junior Member

Posts: 4
Registered: 8/31/2005
Location: San Antonio
Member Is Offline
posted on 9/6/2005 at 09:44 PM Reply With Quote
Last update.


For those of you who wanted to know I was able to impliment a way to allow for validation of dependent form elements.

Here is an example that I used. If my select box purchase was either 'Need to order' or 'Already have', I wanted to validate my textbox Afe to insure it was not null. If the textbox reboot_time wasn't null, I wanted to ensure that my dropdown ampm was not null.

<script language="JavaScript">
var o_fields = {
'reboot_time':{'l':'Time','r':false,'f':'time','t':'v_reboot_time'}
}

//########### validate #############
function validate(f) {

if (f.purchase.options[f.purchase.selectedIndex].text == 'Need to Order' || f.purchase.options[f.purchase.selectedIndex].text == 'Already Have') {
o_fields.afe = {'l':'Afe','r':true,'t':'afelab'}

}
if (f.reboot_time.value) {
o_fields.ampm = {'l':'AMPM','r':true}
}

var tfv = new validator('form', o_fields);
return tfv.exec();
}.

That's it. Though it is certainly not modular it is easy enough to update on a form by form basis.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page Product Page
Product Demonstrations Product Demos
Registration Form Validation
Login Form Validation
Free Download Free Download
Product Documentation Documentation
Documenation Page
Change Log
Validators Comparison Table
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004