RE: Validator-rules.xml -- required fields validation for multiples radios, checkboxes etc

2003-09-15 Thread Yuan, Saul (TOR-ML)
> 
> >Rob,
> >
> >Thanks for your response.
> >
> >I ended up with changing the validator-rules.xml file myself to add
> >support for multiple radios, checkboxes and selections (just for the
> >validateRequired(form) function)
> >
> >
> If you would like to post a BugZilla report and provide a patch
against
> the nightly,
> that can be integarted into the validator code, that would be much
> appreciated !

Sounds good, I'll do that soon.

Saul


> 
> -Rob
> 
> >I checked the validator-rules.xml file in the latest nightly built
(Sep
> >12), I noticed it added support for multiple radio buttons, but not
yet
> >for multiples checkboxes and selections.
> >
> >
> >Thanks,
> >Saul
> >
> >
> >
> >
> >
> >>Use the nightly build of struts, this was fixed on Sept 9.
> >>Please let me know if it works for you.
> >>
> >>-Rob
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>
> >>>
> >>>I have some problems validating multiple radio buttons and
> >>>
> >>>
> >checkboxes,
> >
> >
> >>>selections on the client side. Tracking down to the javascript code
> >>>defined in validator-rules.xml, I found that the
> >>>
> >>>
> >validateRequired(form)
> >
> >
> >>>function doesn't deal with multiple checkboxes, selections at all.
> >>>
> >>>
> >For
> >
> >
> >>>multiples radios, checkboxes etc, the field.type = undefined. Can
> >>>somebody explain why is this?
> >>>
> >>>
> >>>
> >>>Thanks,
> >>>
> >>>Saul
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>Validator-rules.xml:
> >>>
> >>>-
> >>>
> >>>
> >>>
> >>>   function validateRequired(form) {
> >>>
> >>>   var isValid = true;
> >>>
> >>>   var focusField = null;
> >>>
> >>>   var i = 0;
> >>>
> >>>   var fields = new Array();
> >>>
> >>>   oRequired = new required();
> >>>
> >>>   for (x in oRequired) {
> >>>
> >>>   var field = form[oRequired[x][0]];
> >>>
> >>>
> >>>
> >>>   if (field.type == 'text' ||
> >>>
> >>>   field.type == 'textarea' ||
> >>>
> >>>   field.type == 'file' ||
> >>>
> >>>   field.type == 'select-one' ||
> >>>
> >>>   field.type == 'radio' ||
> >>>
> >>>   field.type == 'password') {
> >>>
> >>>
> >>>
> >>>   var value = '';
> >>>
> >>>
> >>>// get field's value
> >>>
> >>>
> >>>if (field.type == "select-one") {
> >>>
> >>>
> >>>var si = field.selectedIndex;
> >>>
> >>>
> >>>if (si >= 0) {
> >>>
> >>>
> >>>value = field.options[si].value;
> >>>
> >>>
> >>>}
> >>>
> >>>
> >>>} else {
> >>>
> >>>
> >>>value = field.value;
> >>>
> >>>
> >>>}
> >>>
> >>>
> >>>
> >>>   if (trim(value).length == 0) {
> >>>
> >>>
> >>>
> >>>   if (i == 0) {
> >>>
> >>>   focusField = field;
> >>>
> >>>   }
> >>>
> >>>   fields[i++] = oRequired[x][1];
> >>>
> >>>   isValid = false;
> >>>
> >>>   }
> >>>
> >>>   }
> >>>
> >>>   }
> >>>
> >>>   if (fields.length > 0) {
> >>>
> >>>  focusField.focus();
> >>>
> >>>  alert(fields.join('\n'));
> >>>
> >>>   }
> >>>
> >>>   return isValid;
> >>>
> >>>   }
> >>>
> >>>
> >>>
> >>>
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Validator-rules.xml -- required fields validation for multiples radios, checkboxes etc

2003-09-12 Thread Robert Leland
Yuan, Saul (TOR-ML) wrote:

Rob,

Thanks for your response.

I ended up with changing the validator-rules.xml file myself to add
support for multiple radios, checkboxes and selections (just for the
validateRequired(form) function)
 

If you would like to post a BugZilla report and provide a patch against 
the nightly,
that can be integarted into the validator code, that would be much 
appreciated !

-Rob

I checked the validator-rules.xml file in the latest nightly built (Sep
12), I noticed it added support for multiple radio buttons, but not yet
for multiples checkboxes and selections.
Thanks,
Saul


 

Use the nightly build of struts, this was fixed on Sept 9.
Please let me know if it works for you.
-Rob

   

Hi,



I have some problems validating multiple radio buttons and
 

checkboxes,
 

selections on the client side. Tracking down to the javascript code
defined in validator-rules.xml, I found that the
 

validateRequired(form)
 

function doesn't deal with multiple checkboxes, selections at all.
 

For
 

multiples radios, checkboxes etc, the field.type = undefined. Can
somebody explain why is this?


Thanks,

Saul





Validator-rules.xml:

-



  function validateRequired(form) {

  var isValid = true;

  var focusField = null;

  var i = 0;

  var fields = new Array();

  oRequired = new required();

  for (x in oRequired) {

  var field = form[oRequired[x][0]];



  if (field.type == 'text' ||

  field.type == 'textarea' ||

  field.type == 'file' ||

  field.type == 'select-one' ||

  field.type == 'radio' ||

  field.type == 'password') {



  var value = '';

// get field's value

if (field.type == "select-one") {

var si = field.selectedIndex;

if (si >= 0) {

value = field.options[si].value;

}

} else {

value = field.value;

}



  if (trim(value).length == 0) {



  if (i == 0) {

  focusField = field;

  }

  fields[i++] = oRequired[x][1];

  isValid = false;

  }

  }

  }

  if (fields.length > 0) {

 focusField.focus();

 alert(fields.join('\n'));

  }

  return isValid;

  }

 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Validator-rules.xml -- required fields validation for multiples radios, checkboxes etc

2003-09-12 Thread Yuan, Saul (TOR-ML)
Rob,

Thanks for your response.

I ended up with changing the validator-rules.xml file myself to add
support for multiple radios, checkboxes and selections (just for the
validateRequired(form) function)

I checked the validator-rules.xml file in the latest nightly built (Sep
12), I noticed it added support for multiple radio buttons, but not yet
for multiples checkboxes and selections.


Thanks,
Saul



> 
> Use the nightly build of struts, this was fixed on Sept 9.
> Please let me know if it works for you.
> 
> -Rob
> 
> >Hi,
> >
> >
> >
> >I have some problems validating multiple radio buttons and
checkboxes,
> >selections on the client side. Tracking down to the javascript code
> >defined in validator-rules.xml, I found that the
validateRequired(form)
> >function doesn't deal with multiple checkboxes, selections at all.
For
> >multiples radios, checkboxes etc, the field.type = undefined. Can
> >somebody explain why is this?
> >
> >
> >
> >Thanks,
> >
> >Saul
> >
> >
> >
> >
> >
> >Validator-rules.xml:
> >
> >-
> >
> >
> >
> >function validateRequired(form) {
> >
> >var isValid = true;
> >
> >var focusField = null;
> >
> >var i = 0;
> >
> >var fields = new Array();
> >
> >oRequired = new required();
> >
> >for (x in oRequired) {
> >
> >var field = form[oRequired[x][0]];
> >
> >
> >
> >if (field.type == 'text' ||
> >
> >field.type == 'textarea' ||
> >
> >field.type == 'file' ||
> >
> >field.type == 'select-one' ||
> >
> >field.type == 'radio' ||
> >
> >field.type == 'password') {
> >
> >
> >
> >var value = '';
> >
> >
> >// get field's value
> >
> >
> >if (field.type == "select-one") {
> >
> >
> >var si = field.selectedIndex;
> >
> >
> >if (si >= 0) {
> >
> >
> >value = field.options[si].value;
> >
> >
> >}
> >
> >
> >} else {
> >
> >
> >value = field.value;
> >
> >
> >}
> >
> >
> >
> >if (trim(value).length == 0) {
> >
> >
> >
> >if (i == 0) {
> >
> >focusField = field;
> >
> >}
> >
> >fields[i++] = oRequired[x][1];
> >
> >isValid = false;
> >
> >}
> >
> >}
> >
> >}
> >
> >if (fields.length > 0) {
> >
> >   focusField.focus();
> >
> >   alert(fields.join('\n'));
> >
> >}
> >
> >return isValid;
> >
> >}
> >
> >
> >
> >
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Validator-rules.xml -- required fields validation for multiples radios, checkboxes etc

2003-09-11 Thread Robert Leland
Yuan, Saul (TOR-ML) wrote:

Use the nightly build of struts, this was fixed on Sept 9.
Please let me know if it works for you.
-Rob

Hi,



I have some problems validating multiple radio buttons and checkboxes,
selections on the client side. Tracking down to the javascript code
defined in validator-rules.xml, I found that the validateRequired(form)
function doesn't deal with multiple checkboxes, selections at all. For
multiples radios, checkboxes etc, the field.type = undefined. Can
somebody explain why is this?


Thanks,

Saul





Validator-rules.xml:

-



   function validateRequired(form) {

   var isValid = true;

   var focusField = null;

   var i = 0;

   var fields = new Array();

   oRequired = new required();

   for (x in oRequired) {

   var field = form[oRequired[x][0]];

   

   if (field.type == 'text' ||

   field.type == 'textarea' ||

   field.type == 'file' ||

   field.type == 'select-one' ||

   field.type == 'radio' ||

   field.type == 'password') {

   

   var value = '';

// get field's value

if (field.type == "select-one") {

var si = field.selectedIndex;

if (si >= 0) {

value = field.options[si].value;

}

} else {

value = field.value;

}

   

   if (trim(value).length == 0) {

   

   if (i == 0) {

   focusField = field;

   }

   fields[i++] = oRequired[x][1];

   isValid = false;

   }

   }

   }

   if (fields.length > 0) {

  focusField.focus();

  alert(fields.join('\n'));

   }

   return isValid;

   }

 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]