Hi,
I posted a question today before this one, and thanks for your quick
answer Peter Knego
I tried all the 4 points you advised me, but it still get errors. So I
have no other way than to present my problem:
I have a Javascript validation framework which needs to be configured
using JSON objects.
I must write an XML-based configuration utility for this client-side
JavaScript validation framework in Java.
After a little of googling I came across Xmappr and I started to have
a good feeling
But finally I could not manage Pls help me if you can! Thanks in
advance
Elemér.
I need to convert the following XML
<?xml version="1.0" encoding="UTF-8"?>
<validations xmlns="
http://www.isdc.ro/vld"
xmlns:xsi="
http://www.w3.org/
2001/XMLSchema-instance"
xsi:schemaLocation="http://
www.isdc.ro/vld vld.xsd">
<validation forElements="#txtPassword,#txtPasswordVerify"
group="pass" groupToValidate="pass" onBefore="beforeValidateHandler">
<onEvents>
<onEvent name="blur"/>
<onEvent target="form" name="submit"/>
</onEvents>
<handlers>
<handler function="defaultVisualFeedbackHandlerJS"/>
</handlers>
<rules>
<rule msg="Password must be at least 6 chars long!"
negate="false" rule="/\w+/"/>
<rule msg="Password must contain lowercase
characters uppercase characters and numbers as well!"
rule="passValidatorJS"/>
</rules>
</validation>
<!—another validations…
<validation></validation>
</validations>
Into Java objects, do some checking and finally convert it into JSON
like follows:
var vlds = {
validations: [{
feedbackElement: null,
group: 'default',
validatable: null, //the group to be validated instead of the
control
onBefore: null,
onAfter: null,
errorClass: 'invalid', //class applied on an invalid control.
onEvent: 'blur', //string:this object's specified standard event
or JSON:{target:a jquery object,name:event name}
handlers: null,//should be overridden in constructor
rules: [{
rule: /\w+/, //can be a regex, a boolean or a function returning
any value
negate: false,//inverses the validation logic:useful if it's
easier to specify when a control is invalid than the case when is
valid.
msg: 'This field is Required!'
}], /*required. A non-empty array of validation rules*/
validateOnCreate: false
}, {/*validation-2*/}, {/*validation-3*/}]
};
Can you please help me, how can I do this as simply as possible?
--
Subscription settings:
http://groups.google.com/group/xmappr/subscribe?hl=en