You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by varun bhansaly <vb...@gmail.com> on 2010/05/28 18:02:33 UTC

Form widget validation

Hi,
What would be the simplest & optimal way to validate xml forms ?
Also is there a way to make use of existing validation frameworks as
http://js-validator.sourceforge.net/ to validate form fields of xml
forms ?

If some1 has done sumthing like this or has sum other ideas, it wud b
great to them.

-- 
Regards,
Varun Bhansaly

Re: Form widget validation

Posted by Ravindra Mandre <ra...@gmail.com>.
 Hi Jacques,
I tried the same trick that you added in FAQ but , we also have to add some
more elements here
like : for making validation for firstName which takes only letters

<field name="firstName" title="${uiLabelMap.PartyFirstName}"

 tooltip="${uiLabelMap.CommonRequired}"  widget-style="required
validate-alpha"  event="onchange"  action="javascript: new
Validation('editPersonalDetail',
                                         {immediate:
true,onSubmit:true}); ">
       <text size="25" maxlength="60"/>
</field>

but Here the problem is that when I click on the submit button , It works
fine for backend means If I added this code for partymgr then there is no
problem while I am using the same form for front end , the submit button
gets disappear. not able to get the whats the reason behind it.


Regards
Ravindra Mandre



On Tue, Jun 1, 2010 at 3:45 PM, Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> Right, done!
>
>
> Jacques
>
> From: "Atul Vani" <at...@hotwaxmedia.com>
>
>> Hi Jacques,
>>
>> Please modify the FAQ and replace 'formName' with 'formId'. It would be
>> clearer that way.
>>
>> Thanks :)
>>
>> --
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
>> yourself.
>>
>>
>> Jacques Le Roux wrote:
>>
>>> Finally I put back your code Atul: safer indeed!
>>>
>>> Jacques
>>>
>>> From: "Atul Vani" <at...@hotwaxmedia.com>
>>>
>>>> Hello Varun,
>>>>
>>>> no wonder this code is simple and correct,
>>>>
>>>> just wanted to tell you that we do take some safety measures before
>>>> writing such code,
>>>> for example,
>>>> before using $('foo') we should make sure if it even exists
>>>> or else the whole script won't load,
>>>> we do that by if($('foo')){...}
>>>>
>>>> also, we need to make sure that if our script uses any element on the
>>>> page
>>>> then it should execute after the element has been loaded
>>>> and we use Event.observe('window', 'load', function(){...})
>>>>
>>>> i hope this info be helpful to you.
>>>>
>>>> --
>>>> Thanks & Regards
>>>> Atul Vani
>>>> Enterprise Software Developer
>>>> HotWax Media Pvt. Ltd.
>>>> http://www.hotwaxmedia.com/
>>>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for
>>>> yourself.
>>>>
>>>>
>>>> Varun Bhansaly wrote:
>>>>
>>>>> Hi,
>>>>> Step 1 could be simplified as
>>>>> <script type="text/javascript">
>>>>>  new Validation('form-id');
>>>>> </script>
>>>>>
>>>>> Step 2 remains the same, Some tweaks are required while showing
>>>>> validation msgs for lookup widgets.
>>>>>
>>>>> Thanks,
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>

Re: Form widget validation

Posted by Jacques Le Roux <ja...@les7arts.com>.
Right, done!

Jacques

From: "Atul Vani" <at...@hotwaxmedia.com>
> Hi Jacques,
> 
> Please modify the FAQ and replace 'formName' with 'formId'. It would be 
> clearer that way.
> 
> Thanks :)
> 
> -- 
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.
> 
> 
> Jacques Le Roux wrote:
>> Finally I put back your code Atul: safer indeed!
>>
>> Jacques
>>
>> From: "Atul Vani" <at...@hotwaxmedia.com>
>>> Hello Varun,
>>>
>>> no wonder this code is simple and correct,
>>>
>>> just wanted to tell you that we do take some safety measures before 
>>> writing such code,
>>> for example,
>>> before using $('foo') we should make sure if it even exists
>>> or else the whole script won't load,
>>> we do that by if($('foo')){...}
>>>
>>> also, we need to make sure that if our script uses any element on the 
>>> page
>>> then it should execute after the element has been loaded
>>> and we use Event.observe('window', 'load', function(){...})
>>>
>>> i hope this info be helpful to you.
>>>
>>> -- 
>>> Thanks & Regards
>>> Atul Vani
>>> Enterprise Software Developer
>>> HotWax Media Pvt. Ltd.
>>> http://www.hotwaxmedia.com/
>>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for 
>>> yourself.
>>>
>>>
>>> Varun Bhansaly wrote:
>>>> Hi,
>>>> Step 1 could be simplified as
>>>> <script type="text/javascript">
>>>>   new Validation('form-id');
>>>> </script>
>>>>
>>>> Step 2 remains the same, Some tweaks are required while showing 
>>>> validation msgs for lookup widgets.
>>>>
>>>> Thanks,
>>>>   
>>>
>>
>


Re: Form widget validation

Posted by Atul Vani <at...@hotwaxmedia.com>.
Hi Jacques,

Please modify the FAQ and replace 'formName' with 'formId'. It would be 
clearer that way.

Thanks :)

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.


Jacques Le Roux wrote:
> Finally I put back your code Atul: safer indeed!
>
> Jacques
>
> From: "Atul Vani" <at...@hotwaxmedia.com>
>> Hello Varun,
>>
>> no wonder this code is simple and correct,
>>
>> just wanted to tell you that we do take some safety measures before 
>> writing such code,
>> for example,
>> before using $('foo') we should make sure if it even exists
>> or else the whole script won't load,
>> we do that by if($('foo')){...}
>>
>> also, we need to make sure that if our script uses any element on the 
>> page
>> then it should execute after the element has been loaded
>> and we use Event.observe('window', 'load', function(){...})
>>
>> i hope this info be helpful to you.
>>
>> -- 
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for 
>> yourself.
>>
>>
>> Varun Bhansaly wrote:
>>> Hi,
>>> Step 1 could be simplified as
>>> <script type="text/javascript">
>>>   new Validation('form-id');
>>> </script>
>>>
>>> Step 2 remains the same, Some tweaks are required while showing 
>>> validation msgs for lookup widgets.
>>>
>>> Thanks,
>>>   
>>
>

Re: Form widget validation

Posted by Jacques Le Roux <ja...@les7arts.com>.
Finally I put back your code Atul: safer indeed!

Jacques

From: "Atul Vani" <at...@hotwaxmedia.com>
> Hello Varun,
> 
> no wonder this code is simple and correct,
> 
> just wanted to tell you that we do take some safety measures before 
> writing such code,
> for example,
> before using $('foo') we should make sure if it even exists
> or else the whole script won't load,
> we do that by if($('foo')){...}
> 
> also, we need to make sure that if our script uses any element on the page
> then it should execute after the element has been loaded
> and we use Event.observe('window', 'load', function(){...})
> 
> i hope this info be helpful to you.
> 
> -- 
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
> We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.
> 
> 
> Varun Bhansaly wrote:
>> Hi,
>> Step 1 could be simplified as 
>>
>> <script type="text/javascript">
>>   new Validation('form-id');
>> </script>
>>
>> Step 2 remains the same, 
>> Some tweaks are required while showing validation msgs for lookup widgets.
>>
>> Thanks,
>>   
>


Re: Form widget validation

Posted by Atul Vani <at...@hotwaxmedia.com>.
Hello Varun,

no wonder this code is simple and correct,

just wanted to tell you that we do take some safety measures before 
writing such code,
for example,
before using $('foo') we should make sure if it even exists
or else the whole script won't load,
we do that by if($('foo')){...}

also, we need to make sure that if our script uses any element on the page
then it should execute after the element has been loaded
and we use Event.observe('window', 'load', function(){...})

i hope this info be helpful to you.

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.


Varun Bhansaly wrote:
> Hi,
> Step 1 could be simplified as 
>
> <script type="text/javascript">
>   new Validation('form-id');
> </script>
>
> Step 2 remains the same, 
> Some tweaks are required while showing validation msgs for lookup widgets.
>
> Thanks,
>   

Re: Form widget validation

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Varun,

I did not check but I replaced the 1st point by your tip

Jacques

From: "Varun Bhansaly" <vb...@gmail.com>
> 
> Hi,
> Step 1 could be simplified as 
> 
> <script type="text/javascript">
>  new Validation('form-id');
> </script>
> 
> Step 2 remains the same, 
> Some tweaks are required while showing validation msgs for lookup widgets.
> 
> Thanks,
> -- 
> View this message in context: http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2237617.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>


Re: Form widget validation

Posted by Varun Bhansaly <vb...@gmail.com>.
Hi,
Step 1 could be simplified as 

<script type="text/javascript">
  new Validation('form-id');
</script>

Step 2 remains the same, 
Some tweaks are required while showing validation msgs for lookup widgets.

Thanks,
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2237617.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form widget validation

Posted by Atul Vani <at...@hotwaxmedia.com>.
Thanks Jacques :)

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/
We are the Global Leaders in Apache OFBiz, Google 'ofbiz' and see for yourself.


Jacques Le Roux wrote:
> Thanks Atul,  Varun,
>
> Atul, I put you tip in FAQ with a link to Varun's
>
> Jacques
>
> From: "Atul Vani" <at...@hotwaxmedia.com>
>> hi Varun,
>>
>> glad to know your problem's solved.
>> and it sure is a nice document, thanks for sharing :)
>>
>> -- 
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>>
>>
>> varun bhansaly wrote:
>>> Thanks Atul, this is good starting point
>>> http://tetlaw.id.au/view/javascript/really-easy-field-validation
>>> <http://tetlaw.id.au/view/javascript/really-easy-field-validation>and 
>>> yes
>>> attribute 'widget-style' holds the key..
>>>
>>> On Sat, May 29, 2010 at 12:00 PM, Atul Vani 
>>> <at...@hotwaxmedia.com>wrote:
>>>
>>>  
>>>> hi Varun,
>>>>
>>>> never came across use of validation.js in xml forms
>>>>
>>>> but this is the sort of thing you need to do
>>>> 1. include a js code like below:-
>>>> Event.observe(window, 'load', function() {
>>>>   if ($('formName'))
>>>>       validateNewUser = new Validation('formName', {immediate: true});
>>>> }
>>>>
>>>> 2. and in the respective form use the suitable class for form fields
>>>> <field ... widget-style="required"> ... </field>
>>>> <field ... widget-style="validate-email"> ... </field>
>>>> <field ... widget-style="validate-url"> ... </field>
>>>> etc
>>>>
>>>> go through the validation.js and you will know about other possible 
>>>> options
>>>> available.
>>>>
>>>>
>>>> -- 
>>>> Thanks & Regards
>>>> Atul Vani
>>>> Enterprise Software Developer
>>>> HotWax Media Pvt. Ltd.
>>>> http://www.hotwaxmedia.com/
>>>>
>>>>
>>>> varun bhansaly wrote:
>>>>
>>>>    
>>>>> Hi Atul,
>>>>> Thanks for the response ! is it already being used somewhere in d 
>>>>> app ?
>>>>>
>>>>> On Sat, May 29, 2010 at 10:11 AM, Atul Vani 
>>>>> <atul.vani@hotwaxmedia.com
>>>>>      
>>>>>> wrote:
>>>>>>         
>>>>>
>>>>>      
>>>>>> hi Varun,
>>>>>>
>>>>>> you can make use of validation.js from
>>>>>> ofbiz-trunk/framework/images/webapp/images/prototypejs/validation.js
>>>>>>
>>>>>> for it to work you will need to apply class to form-fields
>>>>>> which can be done using <field ... widget-style=""/>
>>>>>>
>>>>>> you will also need to make a validator's object in javascript.
>>>>>>
>>>>>> -- 
>>>>>> Thanks & Regards
>>>>>> Atul Vani
>>>>>> Enterprise Software Developer
>>>>>> HotWax Media Pvt. Ltd.
>>>>>> http://www.hotwaxmedia.com/
>>>>>>
>>>>>>
>>>>>>
>>>>>> varun bhansaly wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>        
>>>>>>> Hi,
>>>>>>> What would be the simplest & optimal way to validate xml forms ?
>>>>>>> Also is there a way to make use of existing validation 
>>>>>>> frameworks as
>>>>>>> http://js-validator.sourceforge.net/ to validate form fields of xml
>>>>>>> forms ?
>>>>>>>
>>>>>>> If some1 has done sumthing like this or has sum other ideas, it 
>>>>>>> wud b
>>>>>>> great to them.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>           
>>>>>
>>>>>       
>>>
>>>
>>>   
>>
>

Re: Form widget validation

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Atul,  Varun,

Atul, I put you tip in FAQ with a link to Varun's

Jacques

From: "Atul Vani" <at...@hotwaxmedia.com>
> hi Varun,
> 
> glad to know your problem's solved.
> and it sure is a nice document, thanks for sharing :)
> 
> -- 
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
> 
> 
> varun bhansaly wrote:
>> Thanks Atul, this is good starting point
>> http://tetlaw.id.au/view/javascript/really-easy-field-validation
>> <http://tetlaw.id.au/view/javascript/really-easy-field-validation>and yes
>> attribute 'widget-style' holds the key..
>>
>> On Sat, May 29, 2010 at 12:00 PM, Atul Vani <at...@hotwaxmedia.com>wrote:
>>
>>   
>>> hi Varun,
>>>
>>> never came across use of validation.js in xml forms
>>>
>>> but this is the sort of thing you need to do
>>> 1. include a js code like below:-
>>> Event.observe(window, 'load', function() {
>>>   if ($('formName'))
>>>       validateNewUser = new Validation('formName', {immediate: true});
>>> }
>>>
>>> 2. and in the respective form use the suitable class for form fields
>>> <field ... widget-style="required"> ... </field>
>>> <field ... widget-style="validate-email"> ... </field>
>>> <field ... widget-style="validate-url"> ... </field>
>>> etc
>>>
>>> go through the validation.js and you will know about other possible options
>>> available.
>>>
>>>
>>> --
>>> Thanks & Regards
>>> Atul Vani
>>> Enterprise Software Developer
>>> HotWax Media Pvt. Ltd.
>>> http://www.hotwaxmedia.com/
>>>
>>>
>>> varun bhansaly wrote:
>>>
>>>     
>>>> Hi Atul,
>>>> Thanks for the response ! is it already being used somewhere in d app ?
>>>>
>>>> On Sat, May 29, 2010 at 10:11 AM, Atul Vani <atul.vani@hotwaxmedia.com
>>>>       
>>>>> wrote:
>>>>>         
>>>>
>>>>       
>>>>> hi Varun,
>>>>>
>>>>> you can make use of validation.js from
>>>>> ofbiz-trunk/framework/images/webapp/images/prototypejs/validation.js
>>>>>
>>>>> for it to work you will need to apply class to form-fields
>>>>> which can be done using <field ... widget-style=""/>
>>>>>
>>>>> you will also need to make a validator's object in javascript.
>>>>>
>>>>> --
>>>>> Thanks & Regards
>>>>> Atul Vani
>>>>> Enterprise Software Developer
>>>>> HotWax Media Pvt. Ltd.
>>>>> http://www.hotwaxmedia.com/
>>>>>
>>>>>
>>>>>
>>>>> varun bhansaly wrote:
>>>>>
>>>>>
>>>>>
>>>>>         
>>>>>> Hi,
>>>>>> What would be the simplest & optimal way to validate xml forms ?
>>>>>> Also is there a way to make use of existing validation frameworks as
>>>>>> http://js-validator.sourceforge.net/ to validate form fields of xml
>>>>>> forms ?
>>>>>>
>>>>>> If some1 has done sumthing like this or has sum other ideas, it wud b
>>>>>> great to them.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>           
>>>>
>>>>       
>>
>>
>>   
>


Re: Form widget validation

Posted by Atul Vani <at...@hotwaxmedia.com>.
hi Varun,

glad to know your problem's solved.
and it sure is a nice document, thanks for sharing :)

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/


varun bhansaly wrote:
> Thanks Atul, this is good starting point
> http://tetlaw.id.au/view/javascript/really-easy-field-validation
> <http://tetlaw.id.au/view/javascript/really-easy-field-validation>and yes
> attribute 'widget-style' holds the key..
>
> On Sat, May 29, 2010 at 12:00 PM, Atul Vani <at...@hotwaxmedia.com>wrote:
>
>   
>> hi Varun,
>>
>> never came across use of validation.js in xml forms
>>
>> but this is the sort of thing you need to do
>> 1. include a js code like below:-
>> Event.observe(window, 'load', function() {
>>   if ($('formName'))
>>       validateNewUser = new Validation('formName', {immediate: true});
>> }
>>
>> 2. and in the respective form use the suitable class for form fields
>> <field ... widget-style="required"> ... </field>
>> <field ... widget-style="validate-email"> ... </field>
>> <field ... widget-style="validate-url"> ... </field>
>> etc
>>
>> go through the validation.js and you will know about other possible options
>> available.
>>
>>
>> --
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>>
>>
>> varun bhansaly wrote:
>>
>>     
>>> Hi Atul,
>>> Thanks for the response ! is it already being used somewhere in d app ?
>>>
>>> On Sat, May 29, 2010 at 10:11 AM, Atul Vani <atul.vani@hotwaxmedia.com
>>>       
>>>> wrote:
>>>>         
>>>
>>>       
>>>> hi Varun,
>>>>
>>>> you can make use of validation.js from
>>>> ofbiz-trunk/framework/images/webapp/images/prototypejs/validation.js
>>>>
>>>> for it to work you will need to apply class to form-fields
>>>> which can be done using <field ... widget-style=""/>
>>>>
>>>> you will also need to make a validator's object in javascript.
>>>>
>>>> --
>>>> Thanks & Regards
>>>> Atul Vani
>>>> Enterprise Software Developer
>>>> HotWax Media Pvt. Ltd.
>>>> http://www.hotwaxmedia.com/
>>>>
>>>>
>>>>
>>>> varun bhansaly wrote:
>>>>
>>>>
>>>>
>>>>         
>>>>> Hi,
>>>>> What would be the simplest & optimal way to validate xml forms ?
>>>>> Also is there a way to make use of existing validation frameworks as
>>>>> http://js-validator.sourceforge.net/ to validate form fields of xml
>>>>> forms ?
>>>>>
>>>>> If some1 has done sumthing like this or has sum other ideas, it wud b
>>>>> great to them.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>
>>>       
>
>
>   

Re: Form widget validation

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Based on the comment you made below "Each copy would have the same name, but their IDs would be unique", it may to reread section C.8's second paragraph:
> The values of these attributes must be unique within the document, valid, and any references to these fragment identifiers (both internal and external) must be updated should the values be changed during conversion.

So form.name must be unique within the document, this is the same as for form.id so the implication is that you really should use the same value for both.

Also I think you may have misunderstood the statement you quoted below, my reading of the sentence gives me the impression that they are trying to communicate the fact that you can supply values for id only OR for both of the attribute and that using the same identifier within two separate identifying attributes won't cause a problem.  I don't think the "may" was intended to be applicable to the "identical values" portion of the sentence.  Both name and id are considered to be fragment identifiers (which must be unique within the document) but the xml spec only allows for one identifier per element, this results in some complications regarding how strict they can be in defining the usage of the name attribute until it is fully removed from xhtml.

Regards
Scott

On 28/07/2010, at 9:44 AM, Adrian Crum wrote:

> Thanks! So, the name and id attributes *may* be the same:
> 
> "so identical values may be supplied for both of these attributes to ensure maximum forward and backward compatibility (e.g., <a id="foo" name="foo">...</a>)"
> 
> but they don't have to be.
> 
> One bit of info that I wasn't aware of:
> 
> "Note that in XHTML 1.0, the name attribute of these elements is formally deprecated, and will be removed in a subsequent version of XHTML."
> 
> so ultimately it is a moot point.
> 
> -Adrian
> 
> On 7/27/2010 2:19 PM, Scott Gray wrote:
>> For your reading pleasure:
>> http://www.w3.org/TR/xhtml1/#h-4.10
>> http://www.w3.org/TR/xhtml1/#C_8
>> 
>> Regards
>> Scott
>> 
>> On 28/07/2010, at 2:42 AM, Adrian Crum wrote:
>> 
>>> Are you sure about that? What if you have multiple copies of the form in a screen? Each copy would have the same name, but their IDs would be unique (unique IDs are required for HTML validation to pass).
>>> 
>>> -Adrian
>>> 
>>> On 7/27/2010 3:44 AM, Scott Gray wrote:
>>>> We need to fix this in the framework at some point.  A form's name attribute and its id attribute should never differ, id is really a replacement for name and it should be used in place of it IMO.
>>>> 
>>>> Regards
>>>> Scott
>>>> 
>>>> HotWax Media
>>>> http://www.hotwaxmedia.com
>>>> 
>>>> On 27/07/2010, at 10:35 PM, Ravindra Mandre wrote:
>>>> 
>>>>> Hello Prashanthi,
>>>>> Please read comments inline
>>>>> 
>>>>> On Tue, Jul 27, 2010 at 3:33 PM, prasanthi_ofbiz<
>>>>> prasanthi.sreeramjammisetty@tcs.com>   wrote:
>>>>> 
>>>>>> 
>>>>>> Hi Varun
>>>>>>         I want to validate voucherReference field. So I have applied
>>>>>> widget-style to validate-number in the form. Code for validate-number is
>>>>>> already exists in the validation.js file . Still its not validating the
>>>>>> field.
>>>>>> You can check my form code and the validation field is in bold.
>>>>>> 
>>>>>> 
>>>>>> <form name="CreateAcctgTrans"
>>>>> 
>>>>> 
>>>>> id="createAcctgTrans"
>>>>> 
>>>>> 
>>>>> type="single" target="createAcctgTrans"
>>>>>>       header-row-style="header-row" default-table-style="basic-table">
>>>>>>       <actions>
>>>>>>               <set field="isInactive" value="I"/>
>>>>>>       </actions>
>>>>>>       <auto-fields-service service-name="createAcctgTrans"/>
>>>>>>       <field name="organizationPartyId"><hidden
>>>>>> value="${organizationPartyId}"/></field>
>>>>>>       <field name="acctgTransTypeId">
>>>>>>           <drop-down>
>>>>>>               <entity-options entity-name="AcctgTransType"
>>>>>> description="${description}">
>>>>>>               <entity-constraint name="hasTable" operator="not-equals"
>>>>>> env-name="isInactive"/>
>>>>>>                   <entity-order-by field-name="description"/>
>>>>>>               </entity-options>
>>>>>>           </drop-down>
>>>>>>       </field>
>>>>>>       <field name="voucherRef" widget-style="validate-number"><text
>>>>>> size="30"/></field>
>>>>>> 
>>>>> 
>>>>> field name="voucherRef" widget-style="validate-number"
>>>>> event="onchange"  action="
>>>>> javascript: new Validation('createAcctgTrans',  {immediate:
>>>>> true,onSubmit:true}); "><text size="30"/></field>
>>>>> 
>>>>> 
>>>>> 
>>>>> Regards
>>>>> Ravindra Mandre
>>>>> Bangalore
>>>>> 
>>>>> 
>>>>> 
>>>>>>       <field name="glFiscalTypeId">
>>>>>>           <drop-down>
>>>>>>               <entity-options entity-name="GlFiscalType"
>>>>>> description="${description}" key-field-name="glFiscalTypeId">
>>>>>>                   <entity-order-by field-name="description"/>
>>>>>>               </entity-options>
>>>>>>           </drop-down>
>>>>>>       </field>
>>>>>>       <field name="groupStatusId">
>>>>>>           <drop-down allow-empty="true">
>>>>>>               <entity-options entity-name="StatusItem"
>>>>>> description="${description}" key-field-name="statusId">
>>>>>>                   <entity-constraint name="statusTypeId" operator="equals"
>>>>>> value="ACCTG_ENREC_STATUS"/>
>>>>>>                   <entity-order-by field-name="description"/>
>>>>>>               </entity-options>
>>>>>>           </drop-down>
>>>>>>       </field>
>>>>>>       <field name="fixedAssetId">
>>>>>>           <drop-down allow-empty="true">
>>>>>>               <entity-options entity-name="FixedAsset"
>>>>>> description="${fixedAssetId}">
>>>>>>                   <entity-order-by field-name="fixedAssetId"/>
>>>>>>               </entity-options>
>>>>>>           </drop-down>
>>>>>>       </field>
>>>>>>       <field name="paymentId">
>>>>>>           <lookup target-form-name="LookupPayment" size="20"
>>>>>> maxlength="20"/>
>>>>>>       </field>
>>>>>>       <field name="invoiceId">
>>>>>>           <lookup target-form-name="LookupInvoice" size="20"
>>>>>> maxlength="20"/>
>>>>>>       </field>
>>>>>>       <field name="partyId">
>>>>>>           <lookup target-form-name="LookupPartyName" size="20"
>>>>>> maxlength="20" default-value="${parameters.organizationId}"/>
>>>>>>       </field>
>>>>>> 
>>>>>>       <field name="roleTypeId">
>>>>>>           <drop-down allow-empty="true">
>>>>>>               <entity-options entity-name="RoleType"
>>>>>> description="${description}">
>>>>>>                       <entity-constraint name="hasTable"
>>>>>> operator="not-equals"
>>>>>> env-name="isInactive"/>
>>>>>>                   <entity-order-by field-name="description"/>
>>>>>>               </entity-options>
>>>>>>           </drop-down>
>>>>>>       </field>
>>>>>>       <field name="workEffortId">
>>>>>>           <lookup target-form-name="LookupWorkEffort" size="20"
>>>>>> maxlength="20"/>
>>>>>>       </field>
>>>>>>       <field name="createButton" widget-style="smallSubmit"><submit
>>>>>> button-type="button"/></field>
>>>>>>   </form>
>>>>>> 
>>>>>> Regards
>>>>>> Prasanthi
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
>>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>> 
>>>> 
>> 


Re: Form widget validation

Posted by Adrian Crum <ad...@hlmksw.com>.
Thanks! So, the name and id attributes *may* be the same:

"so identical values may be supplied for both of these attributes to 
ensure maximum forward and backward compatibility (e.g., <a id="foo" 
name="foo">...</a>)"

but they don't have to be.

One bit of info that I wasn't aware of:

"Note that in XHTML 1.0, the name attribute of these elements is 
formally deprecated, and will be removed in a subsequent version of XHTML."

so ultimately it is a moot point.

-Adrian

On 7/27/2010 2:19 PM, Scott Gray wrote:
> For your reading pleasure:
> http://www.w3.org/TR/xhtml1/#h-4.10
> http://www.w3.org/TR/xhtml1/#C_8
>
> Regards
> Scott
>
> On 28/07/2010, at 2:42 AM, Adrian Crum wrote:
>
>> Are you sure about that? What if you have multiple copies of the form in a screen? Each copy would have the same name, but their IDs would be unique (unique IDs are required for HTML validation to pass).
>>
>> -Adrian
>>
>> On 7/27/2010 3:44 AM, Scott Gray wrote:
>>> We need to fix this in the framework at some point.  A form's name attribute and its id attribute should never differ, id is really a replacement for name and it should be used in place of it IMO.
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 27/07/2010, at 10:35 PM, Ravindra Mandre wrote:
>>>
>>>> Hello Prashanthi,
>>>> Please read comments inline
>>>>
>>>> On Tue, Jul 27, 2010 at 3:33 PM, prasanthi_ofbiz<
>>>> prasanthi.sreeramjammisetty@tcs.com>   wrote:
>>>>
>>>>>
>>>>> Hi Varun
>>>>>          I want to validate voucherReference field. So I have applied
>>>>> widget-style to validate-number in the form. Code for validate-number is
>>>>> already exists in the validation.js file . Still its not validating the
>>>>> field.
>>>>> You can check my form code and the validation field is in bold.
>>>>>
>>>>>
>>>>> <form name="CreateAcctgTrans"
>>>>
>>>>
>>>> id="createAcctgTrans"
>>>>
>>>>
>>>> type="single" target="createAcctgTrans"
>>>>>        header-row-style="header-row" default-table-style="basic-table">
>>>>>        <actions>
>>>>>                <set field="isInactive" value="I"/>
>>>>>        </actions>
>>>>>        <auto-fields-service service-name="createAcctgTrans"/>
>>>>>        <field name="organizationPartyId"><hidden
>>>>> value="${organizationPartyId}"/></field>
>>>>>        <field name="acctgTransTypeId">
>>>>>            <drop-down>
>>>>>                <entity-options entity-name="AcctgTransType"
>>>>> description="${description}">
>>>>>                <entity-constraint name="hasTable" operator="not-equals"
>>>>> env-name="isInactive"/>
>>>>>                    <entity-order-by field-name="description"/>
>>>>>                </entity-options>
>>>>>            </drop-down>
>>>>>        </field>
>>>>>        <field name="voucherRef" widget-style="validate-number"><text
>>>>> size="30"/></field>
>>>>>
>>>>
>>>> field name="voucherRef" widget-style="validate-number"
>>>> event="onchange"  action="
>>>> javascript: new Validation('createAcctgTrans',  {immediate:
>>>> true,onSubmit:true}); "><text size="30"/></field>
>>>>
>>>>
>>>>
>>>> Regards
>>>> Ravindra Mandre
>>>> Bangalore
>>>>
>>>>
>>>>
>>>>>        <field name="glFiscalTypeId">
>>>>>            <drop-down>
>>>>>                <entity-options entity-name="GlFiscalType"
>>>>> description="${description}" key-field-name="glFiscalTypeId">
>>>>>                    <entity-order-by field-name="description"/>
>>>>>                </entity-options>
>>>>>            </drop-down>
>>>>>        </field>
>>>>>        <field name="groupStatusId">
>>>>>            <drop-down allow-empty="true">
>>>>>                <entity-options entity-name="StatusItem"
>>>>> description="${description}" key-field-name="statusId">
>>>>>                    <entity-constraint name="statusTypeId" operator="equals"
>>>>> value="ACCTG_ENREC_STATUS"/>
>>>>>                    <entity-order-by field-name="description"/>
>>>>>                </entity-options>
>>>>>            </drop-down>
>>>>>        </field>
>>>>>        <field name="fixedAssetId">
>>>>>            <drop-down allow-empty="true">
>>>>>                <entity-options entity-name="FixedAsset"
>>>>> description="${fixedAssetId}">
>>>>>                    <entity-order-by field-name="fixedAssetId"/>
>>>>>                </entity-options>
>>>>>            </drop-down>
>>>>>        </field>
>>>>>        <field name="paymentId">
>>>>>            <lookup target-form-name="LookupPayment" size="20"
>>>>> maxlength="20"/>
>>>>>        </field>
>>>>>        <field name="invoiceId">
>>>>>            <lookup target-form-name="LookupInvoice" size="20"
>>>>> maxlength="20"/>
>>>>>        </field>
>>>>>        <field name="partyId">
>>>>>            <lookup target-form-name="LookupPartyName" size="20"
>>>>> maxlength="20" default-value="${parameters.organizationId}"/>
>>>>>        </field>
>>>>>
>>>>>        <field name="roleTypeId">
>>>>>            <drop-down allow-empty="true">
>>>>>                <entity-options entity-name="RoleType"
>>>>> description="${description}">
>>>>>                        <entity-constraint name="hasTable"
>>>>> operator="not-equals"
>>>>> env-name="isInactive"/>
>>>>>                    <entity-order-by field-name="description"/>
>>>>>                </entity-options>
>>>>>            </drop-down>
>>>>>        </field>
>>>>>        <field name="workEffortId">
>>>>>            <lookup target-form-name="LookupWorkEffort" size="20"
>>>>> maxlength="20"/>
>>>>>        </field>
>>>>>        <field name="createButton" widget-style="smallSubmit"><submit
>>>>> button-type="button"/></field>
>>>>>    </form>
>>>>>
>>>>> Regards
>>>>> Prasanthi
>>>>> --
>>>>> View this message in context:
>>>>> http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
>>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>>>
>>>
>

Re: Form widget validation

Posted by Scott Gray <sc...@hotwaxmedia.com>.
For your reading pleasure:
http://www.w3.org/TR/xhtml1/#h-4.10
http://www.w3.org/TR/xhtml1/#C_8

Regards
Scott

On 28/07/2010, at 2:42 AM, Adrian Crum wrote:

> Are you sure about that? What if you have multiple copies of the form in a screen? Each copy would have the same name, but their IDs would be unique (unique IDs are required for HTML validation to pass).
> 
> -Adrian
> 
> On 7/27/2010 3:44 AM, Scott Gray wrote:
>> We need to fix this in the framework at some point.  A form's name attribute and its id attribute should never differ, id is really a replacement for name and it should be used in place of it IMO.
>> 
>> Regards
>> Scott
>> 
>> HotWax Media
>> http://www.hotwaxmedia.com
>> 
>> On 27/07/2010, at 10:35 PM, Ravindra Mandre wrote:
>> 
>>> Hello Prashanthi,
>>> Please read comments inline
>>> 
>>> On Tue, Jul 27, 2010 at 3:33 PM, prasanthi_ofbiz<
>>> prasanthi.sreeramjammisetty@tcs.com>  wrote:
>>> 
>>>> 
>>>> Hi Varun
>>>>         I want to validate voucherReference field. So I have applied
>>>> widget-style to validate-number in the form. Code for validate-number is
>>>> already exists in the validation.js file . Still its not validating the
>>>> field.
>>>> You can check my form code and the validation field is in bold.
>>>> 
>>>> 
>>>> <form name="CreateAcctgTrans"
>>> 
>>> 
>>> id="createAcctgTrans"
>>> 
>>> 
>>> type="single" target="createAcctgTrans"
>>>>       header-row-style="header-row" default-table-style="basic-table">
>>>>       <actions>
>>>>               <set field="isInactive" value="I"/>
>>>>       </actions>
>>>>       <auto-fields-service service-name="createAcctgTrans"/>
>>>>       <field name="organizationPartyId"><hidden
>>>> value="${organizationPartyId}"/></field>
>>>>       <field name="acctgTransTypeId">
>>>>           <drop-down>
>>>>               <entity-options entity-name="AcctgTransType"
>>>> description="${description}">
>>>>               <entity-constraint name="hasTable" operator="not-equals"
>>>> env-name="isInactive"/>
>>>>                   <entity-order-by field-name="description"/>
>>>>               </entity-options>
>>>>           </drop-down>
>>>>       </field>
>>>>       <field name="voucherRef" widget-style="validate-number"><text
>>>> size="30"/></field>
>>>> 
>>> 
>>> field name="voucherRef" widget-style="validate-number"
>>> event="onchange"  action="
>>> javascript: new Validation('createAcctgTrans',  {immediate:
>>> true,onSubmit:true}); "><text size="30"/></field>
>>> 
>>> 
>>> 
>>> Regards
>>> Ravindra Mandre
>>> Bangalore
>>> 
>>> 
>>> 
>>>>       <field name="glFiscalTypeId">
>>>>           <drop-down>
>>>>               <entity-options entity-name="GlFiscalType"
>>>> description="${description}" key-field-name="glFiscalTypeId">
>>>>                   <entity-order-by field-name="description"/>
>>>>               </entity-options>
>>>>           </drop-down>
>>>>       </field>
>>>>       <field name="groupStatusId">
>>>>           <drop-down allow-empty="true">
>>>>               <entity-options entity-name="StatusItem"
>>>> description="${description}" key-field-name="statusId">
>>>>                   <entity-constraint name="statusTypeId" operator="equals"
>>>> value="ACCTG_ENREC_STATUS"/>
>>>>                   <entity-order-by field-name="description"/>
>>>>               </entity-options>
>>>>           </drop-down>
>>>>       </field>
>>>>       <field name="fixedAssetId">
>>>>           <drop-down allow-empty="true">
>>>>               <entity-options entity-name="FixedAsset"
>>>> description="${fixedAssetId}">
>>>>                   <entity-order-by field-name="fixedAssetId"/>
>>>>               </entity-options>
>>>>           </drop-down>
>>>>       </field>
>>>>       <field name="paymentId">
>>>>           <lookup target-form-name="LookupPayment" size="20"
>>>> maxlength="20"/>
>>>>       </field>
>>>>       <field name="invoiceId">
>>>>           <lookup target-form-name="LookupInvoice" size="20"
>>>> maxlength="20"/>
>>>>       </field>
>>>>       <field name="partyId">
>>>>           <lookup target-form-name="LookupPartyName" size="20"
>>>> maxlength="20" default-value="${parameters.organizationId}"/>
>>>>       </field>
>>>> 
>>>>       <field name="roleTypeId">
>>>>           <drop-down allow-empty="true">
>>>>               <entity-options entity-name="RoleType"
>>>> description="${description}">
>>>>                       <entity-constraint name="hasTable"
>>>> operator="not-equals"
>>>> env-name="isInactive"/>
>>>>                   <entity-order-by field-name="description"/>
>>>>               </entity-options>
>>>>           </drop-down>
>>>>       </field>
>>>>       <field name="workEffortId">
>>>>           <lookup target-form-name="LookupWorkEffort" size="20"
>>>> maxlength="20"/>
>>>>       </field>
>>>>       <field name="createButton" widget-style="smallSubmit"><submit
>>>> button-type="button"/></field>
>>>>   </form>
>>>> 
>>>> Regards
>>>> Prasanthi
>>>> --
>>>> View this message in context:
>>>> http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
>>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>> 
>> 


Re: Form widget validation

Posted by Adrian Crum <ad...@hlmksw.com>.
Are you sure about that? What if you have multiple copies of the form in 
a screen? Each copy would have the same name, but their IDs would be 
unique (unique IDs are required for HTML validation to pass).

-Adrian

On 7/27/2010 3:44 AM, Scott Gray wrote:
> We need to fix this in the framework at some point.  A form's name attribute and its id attribute should never differ, id is really a replacement for name and it should be used in place of it IMO.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 27/07/2010, at 10:35 PM, Ravindra Mandre wrote:
>
>> Hello Prashanthi,
>> Please read comments inline
>>
>> On Tue, Jul 27, 2010 at 3:33 PM, prasanthi_ofbiz<
>> prasanthi.sreeramjammisetty@tcs.com>  wrote:
>>
>>>
>>> Hi Varun
>>>          I want to validate voucherReference field. So I have applied
>>> widget-style to validate-number in the form. Code for validate-number is
>>> already exists in the validation.js file . Still its not validating the
>>> field.
>>> You can check my form code and the validation field is in bold.
>>>
>>>
>>> <form name="CreateAcctgTrans"
>>
>>
>> id="createAcctgTrans"
>>
>>
>> type="single" target="createAcctgTrans"
>>>        header-row-style="header-row" default-table-style="basic-table">
>>>        <actions>
>>>                <set field="isInactive" value="I"/>
>>>        </actions>
>>>        <auto-fields-service service-name="createAcctgTrans"/>
>>>        <field name="organizationPartyId"><hidden
>>> value="${organizationPartyId}"/></field>
>>>        <field name="acctgTransTypeId">
>>>            <drop-down>
>>>                <entity-options entity-name="AcctgTransType"
>>> description="${description}">
>>>                <entity-constraint name="hasTable" operator="not-equals"
>>> env-name="isInactive"/>
>>>                    <entity-order-by field-name="description"/>
>>>                </entity-options>
>>>            </drop-down>
>>>        </field>
>>>        <field name="voucherRef" widget-style="validate-number"><text
>>> size="30"/></field>
>>>
>>
>> field name="voucherRef" widget-style="validate-number"
>> event="onchange"  action="
>> javascript: new Validation('createAcctgTrans',  {immediate:
>> true,onSubmit:true}); "><text size="30"/></field>
>>
>>
>>
>> Regards
>> Ravindra Mandre
>> Bangalore
>>
>>
>>
>>>        <field name="glFiscalTypeId">
>>>            <drop-down>
>>>                <entity-options entity-name="GlFiscalType"
>>> description="${description}" key-field-name="glFiscalTypeId">
>>>                    <entity-order-by field-name="description"/>
>>>                </entity-options>
>>>            </drop-down>
>>>        </field>
>>>        <field name="groupStatusId">
>>>            <drop-down allow-empty="true">
>>>                <entity-options entity-name="StatusItem"
>>> description="${description}" key-field-name="statusId">
>>>                    <entity-constraint name="statusTypeId" operator="equals"
>>> value="ACCTG_ENREC_STATUS"/>
>>>                    <entity-order-by field-name="description"/>
>>>                </entity-options>
>>>            </drop-down>
>>>        </field>
>>>        <field name="fixedAssetId">
>>>            <drop-down allow-empty="true">
>>>                <entity-options entity-name="FixedAsset"
>>> description="${fixedAssetId}">
>>>                    <entity-order-by field-name="fixedAssetId"/>
>>>                </entity-options>
>>>            </drop-down>
>>>        </field>
>>>        <field name="paymentId">
>>>            <lookup target-form-name="LookupPayment" size="20"
>>> maxlength="20"/>
>>>        </field>
>>>        <field name="invoiceId">
>>>            <lookup target-form-name="LookupInvoice" size="20"
>>> maxlength="20"/>
>>>        </field>
>>>        <field name="partyId">
>>>            <lookup target-form-name="LookupPartyName" size="20"
>>> maxlength="20" default-value="${parameters.organizationId}"/>
>>>        </field>
>>>
>>>        <field name="roleTypeId">
>>>            <drop-down allow-empty="true">
>>>                <entity-options entity-name="RoleType"
>>> description="${description}">
>>>                        <entity-constraint name="hasTable"
>>> operator="not-equals"
>>> env-name="isInactive"/>
>>>                    <entity-order-by field-name="description"/>
>>>                </entity-options>
>>>            </drop-down>
>>>        </field>
>>>        <field name="workEffortId">
>>>            <lookup target-form-name="LookupWorkEffort" size="20"
>>> maxlength="20"/>
>>>        </field>
>>>        <field name="createButton" widget-style="smallSubmit"><submit
>>> button-type="button"/></field>
>>>    </form>
>>>
>>> Regards
>>> Prasanthi
>>> --
>>> View this message in context:
>>> http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
>>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>>
>

Re: Form widget validation

Posted by Ravindra Mandre <ra...@gmail.com>.
Thanks scott for comments , but as I generally used that form id is used in
*.js file, we use form name at one or two places where we want to validate
the form.
and yes If it is fixed in framework then its great.

Regards
Ravindra Mandre

On Tue, Jul 27, 2010 at 4:14 PM, Scott Gray <sc...@hotwaxmedia.com>wrote:

> We need to fix this in the framework at some point.  A form's name
> attribute and its id attribute should never differ, id is really a
> replacement for name and it should be used in place of it IMO.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 27/07/2010, at 10:35 PM, Ravindra Mandre wrote:
>
> > Hello Prashanthi,
> > Please read comments inline
> >
> > On Tue, Jul 27, 2010 at 3:33 PM, prasanthi_ofbiz <
> > prasanthi.sreeramjammisetty@tcs.com> wrote:
> >
> >>
> >> Hi Varun
> >>         I want to validate voucherReference field. So I have applied
> >> widget-style to validate-number in the form. Code for validate-number is
> >> already exists in the validation.js file . Still its not validating the
> >> field.
> >> You can check my form code and the validation field is in bold.
> >>
> >>
> >> <form name="CreateAcctgTrans"
> >
> >
> > id="createAcctgTrans"
> >
> >
> > type="single" target="createAcctgTrans"
> >>       header-row-style="header-row" default-table-style="basic-table">
> >>       <actions>
> >>               <set field="isInactive" value="I"/>
> >>       </actions>
> >>       <auto-fields-service service-name="createAcctgTrans"/>
> >>       <field name="organizationPartyId"><hidden
> >> value="${organizationPartyId}"/></field>
> >>       <field name="acctgTransTypeId">
> >>           <drop-down>
> >>               <entity-options entity-name="AcctgTransType"
> >> description="${description}">
> >>               <entity-constraint name="hasTable" operator="not-equals"
> >> env-name="isInactive"/>
> >>                   <entity-order-by field-name="description"/>
> >>               </entity-options>
> >>           </drop-down>
> >>       </field>
> >>       <field name="voucherRef" widget-style="validate-number"><text
> >> size="30"/></field>
> >>
> >
> > field name="voucherRef" widget-style="validate-number"
> > event="onchange"  action="
> > javascript: new Validation('createAcctgTrans',  {immediate:
> > true,onSubmit:true}); "><text size="30"/></field>
> >
> >
> >
> > Regards
> > Ravindra Mandre
> > Bangalore
> >
> >
> >
> >>       <field name="glFiscalTypeId">
> >>           <drop-down>
> >>               <entity-options entity-name="GlFiscalType"
> >> description="${description}" key-field-name="glFiscalTypeId">
> >>                   <entity-order-by field-name="description"/>
> >>               </entity-options>
> >>           </drop-down>
> >>       </field>
> >>       <field name="groupStatusId">
> >>           <drop-down allow-empty="true">
> >>               <entity-options entity-name="StatusItem"
> >> description="${description}" key-field-name="statusId">
> >>                   <entity-constraint name="statusTypeId"
> operator="equals"
> >> value="ACCTG_ENREC_STATUS"/>
> >>                   <entity-order-by field-name="description"/>
> >>               </entity-options>
> >>           </drop-down>
> >>       </field>
> >>       <field name="fixedAssetId">
> >>           <drop-down allow-empty="true">
> >>               <entity-options entity-name="FixedAsset"
> >> description="${fixedAssetId}">
> >>                   <entity-order-by field-name="fixedAssetId"/>
> >>               </entity-options>
> >>           </drop-down>
> >>       </field>
> >>       <field name="paymentId">
> >>           <lookup target-form-name="LookupPayment" size="20"
> >> maxlength="20"/>
> >>       </field>
> >>       <field name="invoiceId">
> >>           <lookup target-form-name="LookupInvoice" size="20"
> >> maxlength="20"/>
> >>       </field>
> >>       <field name="partyId">
> >>           <lookup target-form-name="LookupPartyName" size="20"
> >> maxlength="20" default-value="${parameters.organizationId}"/>
> >>       </field>
> >>
> >>       <field name="roleTypeId">
> >>           <drop-down allow-empty="true">
> >>               <entity-options entity-name="RoleType"
> >> description="${description}">
> >>                       <entity-constraint name="hasTable"
> >> operator="not-equals"
> >> env-name="isInactive"/>
> >>                   <entity-order-by field-name="description"/>
> >>               </entity-options>
> >>           </drop-down>
> >>       </field>
> >>       <field name="workEffortId">
> >>           <lookup target-form-name="LookupWorkEffort" size="20"
> >> maxlength="20"/>
> >>       </field>
> >>       <field name="createButton" widget-style="smallSubmit"><submit
> >> button-type="button"/></field>
> >>   </form>
> >>
> >> Regards
> >> Prasanthi
> >> --
> >> View this message in context:
> >>
> http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
> >> Sent from the OFBiz - User mailing list archive at Nabble.com.
> >>
>
>

Re: Form widget validation

Posted by Scott Gray <sc...@hotwaxmedia.com>.
We need to fix this in the framework at some point.  A form's name attribute and its id attribute should never differ, id is really a replacement for name and it should be used in place of it IMO.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 27/07/2010, at 10:35 PM, Ravindra Mandre wrote:

> Hello Prashanthi,
> Please read comments inline
> 
> On Tue, Jul 27, 2010 at 3:33 PM, prasanthi_ofbiz <
> prasanthi.sreeramjammisetty@tcs.com> wrote:
> 
>> 
>> Hi Varun
>>         I want to validate voucherReference field. So I have applied
>> widget-style to validate-number in the form. Code for validate-number is
>> already exists in the validation.js file . Still its not validating the
>> field.
>> You can check my form code and the validation field is in bold.
>> 
>> 
>> <form name="CreateAcctgTrans"
> 
> 
> id="createAcctgTrans"
> 
> 
> type="single" target="createAcctgTrans"
>>       header-row-style="header-row" default-table-style="basic-table">
>>       <actions>
>>               <set field="isInactive" value="I"/>
>>       </actions>
>>       <auto-fields-service service-name="createAcctgTrans"/>
>>       <field name="organizationPartyId"><hidden
>> value="${organizationPartyId}"/></field>
>>       <field name="acctgTransTypeId">
>>           <drop-down>
>>               <entity-options entity-name="AcctgTransType"
>> description="${description}">
>>               <entity-constraint name="hasTable" operator="not-equals"
>> env-name="isInactive"/>
>>                   <entity-order-by field-name="description"/>
>>               </entity-options>
>>           </drop-down>
>>       </field>
>>       <field name="voucherRef" widget-style="validate-number"><text
>> size="30"/></field>
>> 
> 
> field name="voucherRef" widget-style="validate-number"
> event="onchange"  action="
> javascript: new Validation('createAcctgTrans',  {immediate:
> true,onSubmit:true}); "><text size="30"/></field>
> 
> 
> 
> Regards
> Ravindra Mandre
> Bangalore
> 
> 
> 
>>       <field name="glFiscalTypeId">
>>           <drop-down>
>>               <entity-options entity-name="GlFiscalType"
>> description="${description}" key-field-name="glFiscalTypeId">
>>                   <entity-order-by field-name="description"/>
>>               </entity-options>
>>           </drop-down>
>>       </field>
>>       <field name="groupStatusId">
>>           <drop-down allow-empty="true">
>>               <entity-options entity-name="StatusItem"
>> description="${description}" key-field-name="statusId">
>>                   <entity-constraint name="statusTypeId" operator="equals"
>> value="ACCTG_ENREC_STATUS"/>
>>                   <entity-order-by field-name="description"/>
>>               </entity-options>
>>           </drop-down>
>>       </field>
>>       <field name="fixedAssetId">
>>           <drop-down allow-empty="true">
>>               <entity-options entity-name="FixedAsset"
>> description="${fixedAssetId}">
>>                   <entity-order-by field-name="fixedAssetId"/>
>>               </entity-options>
>>           </drop-down>
>>       </field>
>>       <field name="paymentId">
>>           <lookup target-form-name="LookupPayment" size="20"
>> maxlength="20"/>
>>       </field>
>>       <field name="invoiceId">
>>           <lookup target-form-name="LookupInvoice" size="20"
>> maxlength="20"/>
>>       </field>
>>       <field name="partyId">
>>           <lookup target-form-name="LookupPartyName" size="20"
>> maxlength="20" default-value="${parameters.organizationId}"/>
>>       </field>
>> 
>>       <field name="roleTypeId">
>>           <drop-down allow-empty="true">
>>               <entity-options entity-name="RoleType"
>> description="${description}">
>>                       <entity-constraint name="hasTable"
>> operator="not-equals"
>> env-name="isInactive"/>
>>                   <entity-order-by field-name="description"/>
>>               </entity-options>
>>           </drop-down>
>>       </field>
>>       <field name="workEffortId">
>>           <lookup target-form-name="LookupWorkEffort" size="20"
>> maxlength="20"/>
>>       </field>
>>       <field name="createButton" widget-style="smallSubmit"><submit
>> button-type="button"/></field>
>>   </form>
>> 
>> Regards
>> Prasanthi
>> --
>> View this message in context:
>> http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>> 


Re: Form widget validation

Posted by prasanthi_ofbiz <pr...@tcs.com>.
Hi Ravindra,
Thanks. Now its working fine.
Regards
Prasanthi
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303505.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form widget validation

Posted by Ravindra Mandre <ra...@gmail.com>.
Hello Prashanthi ,
you have to include validation.js file which is in prototypejs folder in
framework. this file generally included in main decorator of customize
component.
take reference from CommonScreens.xml of ecommerce component.

HTH

Regards
Ravindra Mandre

Re: Form widget validation

Posted by prasanthi_ofbiz <pr...@tcs.com>.
Hi Ravindra Mandre
Thanks for u r support. But still its not working. In the Browser Error
console its giving error like validation is not defined. If I see the source
its included lot of .js files . Here there is no validation.js and giving
error at line mentioned in bold

<!-- Begin Screen component://accounting/widget/GlScreens.xml#NewAcctgTrans
-->
<!-- Begin Screen
component://accounting/widget/CommonScreens.xml#CommonPartyAccountsDecorator
-->
<!-- Begin Screen
component://accounting/widget/CommonScreens.xml#CommonPartyDecorator -->
<!-- Begin Screen
component://accounting/widget/CommonScreens.xml#main-decorator -->
<!-- Begin Screen
component://commonext/widget/CommonScreens.xml#ApplicationDecorator -->
<!-- Begin Section Widget  -->
<!-- End Section Widget  -->
<!-- Begin Screen
component://common/widget/CommonScreens.xml#GlobalDecorator -->
<!-- Begin Template component://green/includes/header.ftl -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Bhubaneswar |Accounting Manager: Create an Accounting
Transaction</title>

      <link rel="shortcut icon" href="/images/ofbiz.ico" />
                <script src="/images/prototypejs/prototype.js"
type="text/javascript"></script>
                <script src="/images/prototypejs/scriptaculous.js"
type="text/javascript"></script>
                <script src="/images/selectall.js"
type="text/javascript"></script>
                <script src="/images/fieldlookup.js"
type="text/javascript"></script>
                <script src="/images/calendar_date_select.js"
type="text/javascript"></script>

                <script src="/images/GooglemapMarkers.js"
type="text/javascript"></script>
            <link rel="stylesheet" href="/green/maincss.css"
type="text/css"/>
</head>

-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303444.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form widget validation

Posted by Ravindra Mandre <ra...@gmail.com>.
Hello Prashanthi,
Please read comments inline

On Tue, Jul 27, 2010 at 3:33 PM, prasanthi_ofbiz <
prasanthi.sreeramjammisetty@tcs.com> wrote:

>
> Hi Varun
>          I want to validate voucherReference field. So I have applied
> widget-style to validate-number in the form. Code for validate-number is
> already exists in the validation.js file . Still its not validating the
> field.
> You can check my form code and the validation field is in bold.
>
>
> <form name="CreateAcctgTrans"


id="createAcctgTrans"


type="single" target="createAcctgTrans"
>        header-row-style="header-row" default-table-style="basic-table">
>        <actions>
>                <set field="isInactive" value="I"/>
>        </actions>
>        <auto-fields-service service-name="createAcctgTrans"/>
>        <field name="organizationPartyId"><hidden
> value="${organizationPartyId}"/></field>
>        <field name="acctgTransTypeId">
>            <drop-down>
>                <entity-options entity-name="AcctgTransType"
> description="${description}">
>                <entity-constraint name="hasTable" operator="not-equals"
> env-name="isInactive"/>
>                    <entity-order-by field-name="description"/>
>                </entity-options>
>            </drop-down>
>        </field>
>        <field name="voucherRef" widget-style="validate-number"><text
> size="30"/></field>
>

field name="voucherRef" widget-style="validate-number"
event="onchange"  action="
javascript: new Validation('createAcctgTrans',  {immediate:
true,onSubmit:true}); "><text size="30"/></field>



Regards
Ravindra Mandre
Bangalore



>        <field name="glFiscalTypeId">
>            <drop-down>
>                <entity-options entity-name="GlFiscalType"
> description="${description}" key-field-name="glFiscalTypeId">
>                    <entity-order-by field-name="description"/>
>                </entity-options>
>            </drop-down>
>        </field>
>        <field name="groupStatusId">
>            <drop-down allow-empty="true">
>                <entity-options entity-name="StatusItem"
> description="${description}" key-field-name="statusId">
>                    <entity-constraint name="statusTypeId" operator="equals"
> value="ACCTG_ENREC_STATUS"/>
>                    <entity-order-by field-name="description"/>
>                </entity-options>
>            </drop-down>
>        </field>
>        <field name="fixedAssetId">
>            <drop-down allow-empty="true">
>                <entity-options entity-name="FixedAsset"
> description="${fixedAssetId}">
>                    <entity-order-by field-name="fixedAssetId"/>
>                </entity-options>
>            </drop-down>
>        </field>
>        <field name="paymentId">
>            <lookup target-form-name="LookupPayment" size="20"
> maxlength="20"/>
>        </field>
>        <field name="invoiceId">
>            <lookup target-form-name="LookupInvoice" size="20"
> maxlength="20"/>
>        </field>
>        <field name="partyId">
>            <lookup target-form-name="LookupPartyName" size="20"
> maxlength="20" default-value="${parameters.organizationId}"/>
>        </field>
>
>        <field name="roleTypeId">
>            <drop-down allow-empty="true">
>                <entity-options entity-name="RoleType"
> description="${description}">
>                        <entity-constraint name="hasTable"
> operator="not-equals"
> env-name="isInactive"/>
>                    <entity-order-by field-name="description"/>
>                </entity-options>
>            </drop-down>
>        </field>
>        <field name="workEffortId">
>            <lookup target-form-name="LookupWorkEffort" size="20"
> maxlength="20"/>
>        </field>
>        <field name="createButton" widget-style="smallSubmit"><submit
> button-type="button"/></field>
>    </form>
>
> Regards
> Prasanthi
> --
> View this message in context:
> http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>

Re: Form widget validation

Posted by prasanthi_ofbiz <pr...@tcs.com>.
Hi Varun
          I want to validate voucherReference field. So I have applied
widget-style to validate-number in the form. Code for validate-number is
already exists in the validation.js file . Still its not validating the
field. 
You can check my form code and the validation field is in bold.


<form name="CreateAcctgTrans" type="single" target="createAcctgTrans"
        header-row-style="header-row" default-table-style="basic-table">
        <actions>
        	<set field="isInactive" value="I"/> 
        </actions>
        <auto-fields-service service-name="createAcctgTrans"/>
        <field name="organizationPartyId"><hidden
value="${organizationPartyId}"/></field>
        <field name="acctgTransTypeId">
            <drop-down>
                <entity-options entity-name="AcctgTransType"
description="${description}">
                <entity-constraint name="hasTable" operator="not-equals"
env-name="isInactive"/> 
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="voucherRef" widget-style="validate-number"><text
size="30"/></field>
        <field name="glFiscalTypeId">
            <drop-down>
                <entity-options entity-name="GlFiscalType"
description="${description}" key-field-name="glFiscalTypeId">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="groupStatusId">
            <drop-down allow-empty="true">
                <entity-options entity-name="StatusItem"
description="${description}" key-field-name="statusId">
                    <entity-constraint name="statusTypeId" operator="equals"
value="ACCTG_ENREC_STATUS"/>
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="fixedAssetId">
            <drop-down allow-empty="true">
                <entity-options entity-name="FixedAsset"
description="${fixedAssetId}">
                    <entity-order-by field-name="fixedAssetId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="paymentId">
            <lookup target-form-name="LookupPayment" size="20"
maxlength="20"/>
        </field>
        <field name="invoiceId">
            <lookup target-form-name="LookupInvoice" size="20"
maxlength="20"/>
        </field>
        <field name="partyId">
            <lookup target-form-name="LookupPartyName" size="20"
maxlength="20" default-value="${parameters.organizationId}"/>
        </field>

        <field name="roleTypeId">
            <drop-down allow-empty="true">
                <entity-options entity-name="RoleType"
description="${description}">
                	<entity-constraint name="hasTable" operator="not-equals"
env-name="isInactive"/>
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="workEffortId">
            <lookup target-form-name="LookupWorkEffort" size="20"
maxlength="20"/>
        </field>
        <field name="createButton" widget-style="smallSubmit"><submit
button-type="button"/></field>
    </form>

Regards
Prasanthi
-- 
View this message in context: http://ofbiz.135035.n4.nabble.com/Form-widget-validation-tp2234816p2303395.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: Form widget validation

Posted by varun bhansaly <vb...@gmail.com>.
Thanks Atul, this is good starting point
http://tetlaw.id.au/view/javascript/really-easy-field-validation
<http://tetlaw.id.au/view/javascript/really-easy-field-validation>and yes
attribute 'widget-style' holds the key..

On Sat, May 29, 2010 at 12:00 PM, Atul Vani <at...@hotwaxmedia.com>wrote:

> hi Varun,
>
> never came across use of validation.js in xml forms
>
> but this is the sort of thing you need to do
> 1. include a js code like below:-
> Event.observe(window, 'load', function() {
>   if ($('formName'))
>       validateNewUser = new Validation('formName', {immediate: true});
> }
>
> 2. and in the respective form use the suitable class for form fields
> <field ... widget-style="required"> ... </field>
> <field ... widget-style="validate-email"> ... </field>
> <field ... widget-style="validate-url"> ... </field>
> etc
>
> go through the validation.js and you will know about other possible options
> available.
>
>
> --
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
>
>
> varun bhansaly wrote:
>
>> Hi Atul,
>> Thanks for the response ! is it already being used somewhere in d app ?
>>
>> On Sat, May 29, 2010 at 10:11 AM, Atul Vani <atul.vani@hotwaxmedia.com
>> >wrote:
>>
>>
>>
>>> hi Varun,
>>>
>>> you can make use of validation.js from
>>> ofbiz-trunk/framework/images/webapp/images/prototypejs/validation.js
>>>
>>> for it to work you will need to apply class to form-fields
>>> which can be done using <field ... widget-style=""/>
>>>
>>> you will also need to make a validator's object in javascript.
>>>
>>> --
>>> Thanks & Regards
>>> Atul Vani
>>> Enterprise Software Developer
>>> HotWax Media Pvt. Ltd.
>>> http://www.hotwaxmedia.com/
>>>
>>>
>>>
>>> varun bhansaly wrote:
>>>
>>>
>>>
>>>> Hi,
>>>> What would be the simplest & optimal way to validate xml forms ?
>>>> Also is there a way to make use of existing validation frameworks as
>>>> http://js-validator.sourceforge.net/ to validate form fields of xml
>>>> forms ?
>>>>
>>>> If some1 has done sumthing like this or has sum other ideas, it wud b
>>>> great to them.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>


-- 
Regards,
Varun Bhansaly

Re: Form widget validation

Posted by Atul Vani <at...@hotwaxmedia.com>.
hi Varun,

never came across use of validation.js in xml forms

but this is the sort of thing you need to do
1. include a js code like below:-
Event.observe(window, 'load', function() {
    if ($('formName'))
        validateNewUser = new Validation('formName', {immediate: true});
}

2. and in the respective form use the suitable class for form fields
<field ... widget-style="required"> ... </field>
<field ... widget-style="validate-email"> ... </field>
<field ... widget-style="validate-url"> ... </field>
etc

go through the validation.js and you will know about other possible 
options available.

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/


varun bhansaly wrote:
> Hi Atul,
> Thanks for the response ! is it already being used somewhere in d app ?
>
> On Sat, May 29, 2010 at 10:11 AM, Atul Vani <at...@hotwaxmedia.com>wrote:
>
>   
>> hi Varun,
>>
>> you can make use of validation.js from
>> ofbiz-trunk/framework/images/webapp/images/prototypejs/validation.js
>>
>> for it to work you will need to apply class to form-fields
>> which can be done using <field ... widget-style=""/>
>>
>> you will also need to make a validator's object in javascript.
>>
>> --
>> Thanks & Regards
>> Atul Vani
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>> http://www.hotwaxmedia.com/
>>
>>
>>
>> varun bhansaly wrote:
>>
>>     
>>> Hi,
>>> What would be the simplest & optimal way to validate xml forms ?
>>> Also is there a way to make use of existing validation frameworks as
>>> http://js-validator.sourceforge.net/ to validate form fields of xml
>>> forms ?
>>>
>>> If some1 has done sumthing like this or has sum other ideas, it wud b
>>> great to them.
>>>
>>>
>>>
>>>       
>
>
>   

Re: Form widget validation

Posted by varun bhansaly <vb...@gmail.com>.
Hi Atul,
Thanks for the response ! is it already being used somewhere in d app ?

On Sat, May 29, 2010 at 10:11 AM, Atul Vani <at...@hotwaxmedia.com>wrote:

> hi Varun,
>
> you can make use of validation.js from
> ofbiz-trunk/framework/images/webapp/images/prototypejs/validation.js
>
> for it to work you will need to apply class to form-fields
> which can be done using <field ... widget-style=""/>
>
> you will also need to make a validator's object in javascript.
>
> --
> Thanks & Regards
> Atul Vani
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
> http://www.hotwaxmedia.com/
>
>
>
> varun bhansaly wrote:
>
>> Hi,
>> What would be the simplest & optimal way to validate xml forms ?
>> Also is there a way to make use of existing validation frameworks as
>> http://js-validator.sourceforge.net/ to validate form fields of xml
>> forms ?
>>
>> If some1 has done sumthing like this or has sum other ideas, it wud b
>> great to them.
>>
>>
>>
>


-- 
Regards,
Varun Bhansaly

Re: Form widget validation

Posted by Atul Vani <at...@hotwaxmedia.com>.
hi Varun,

you can make use of validation.js from
ofbiz-trunk/framework/images/webapp/images/prototypejs/validation.js

for it to work you will need to apply class to form-fields
which can be done using <field ... widget-style=""/>

you will also need to make a validator's object in javascript.

-- 
Thanks & Regards
Atul Vani
Enterprise Software Developer
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com/


varun bhansaly wrote:
> Hi,
> What would be the simplest & optimal way to validate xml forms ?
> Also is there a way to make use of existing validation frameworks as
> http://js-validator.sourceforge.net/ to validate form fields of xml
> forms ?
>
> If some1 has done sumthing like this or has sum other ideas, it wud b
> great to them.
>
>