Hi Ramsey, Thanks for reply,Am attaching the javascript file named as gen_validatorv2.js with this mail,which is sample code and am using it, it contains the total my javascript code.
gen_validatorv2.js
--------------------------
case "notselected":
{
if(objValue.selectedIndex == null)
{
alert("BUG: dontselect command for non-select Item");
return false;
}
if(objValue.selectedIndex == -1)
{
if(!strError || strError.length ==0)
{
strError = objValue.name+": Please Select one option ";
}//if
alert(strError);
return false;
}
break;
}//case notselected
<WEBOBJECT NAME=JavaScript1></WEBOBJECT>
<SCRIPT TYPE=text/javascript><!--
function checkAddPreProducts(){
clear_validations();
var formObj = document.MyFormName;
if(formObj != null){
alert("Form obj:"+ formObj);
var frmvalidator = new Validator(formObj.name<http://formobj.name/>
);
if(document.getElementById("Avail PrerequisiteProducts").length > 0)
*frmvalidator.addValidation("Avail
PrerequisiteProducts","notselected=0","Please select atleast one Available
Prerequisite Product");*
else
alert("List is empty");
}
}
// -->
</SCRIPT>
JavaScript1: WOJavaScript {
scriptFile = "gen_validatorv2.js";
}
AjaxSubmitButton contains the binding as followed
onClick = "checkAddPreProducts()";
**
Thanks
Venu
On Thu, Feb 11, 2010 at 5:05 AM, Ramsey Lee Gurley <[email protected]> wrote:
> Hi Venu,
>
> For the benefit of others, please keep replies on the mailing list. With
> regards to this question, I'm not sure how to answer. The part that is
> failing is not included in the message. Perhaps if you were to post the js
> for Validator, I or someone here might be able to assist you.
>
> Generally though, I find it easiest to find where a method fails by
> stepping through it with the debugger. It can be time consuming, but that
> is sometimes the only way.
>
> Ramsey
>
>
> On Feb 10, 2010, at 9:44 AM, Venu A wrote:
>
> Hi Ramsey,
>
> I called a javascript function when a ajaxsubmit button is clicked.But it
> is not working fine
>
> My java script function is as followed
>
> <WEBOBJECT NAME=JavaScript1></WEBOBJECT>
> <SCRIPT TYPE=text/javascript><!--
>
> function checkAddPreProducts(){
> clear_validations();
> var formObj = document.MyFormName;
> if(formObj != null){
> alert("Form obj:"+ formObj);
> var frmvalidator = new Validator(formObj.name);
> if(document.getElementById("Avail PrerequisiteProducts").length >
> 0)
> frmvalidator.addValidation("
> Avail PrerequisiteProducts","notselected=0","Please select atleast one
> Available Prerequisite Product");
> else
> alert("List is empty");
> }
> }
>
> // -->
> </SCRIPT>
>
> In wod file
>
> JavaScript1: WOJavaScript {
> scriptFile = "gen_validatorv2.js";
> }
>
>
> AjaxSubmitButton contains the binding as followed
> onClick = "checkAddPreProducts()";
>
>
> when i clicked on AjaxSubmitButton the javascript function is executing
> (means it is coming in to the if or else part of the function), when it is
> coming to the
> else part it is showing the message(alert message),but in case of if
> condition it is not working(it is coming to inside if but not executed the
> *frmvalidator.addValidation(...)*)
>
> frmvalidator.addValidation("Avail
> PrerequisiteProducts","notselected=0","Please select atleast one Available
> Prerequisite Product");
>
>
> could u suggest me in this? how can i make it is working well(JavaScript)?
>
>
> thanks and regards
> Venu
>
>
>
genvalidator_v2.js
Description: JavaScript source
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
