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 |
Hi Ravindra,
Thanks. Now its working fine. Regards Prasanthi |
In reply to this post by Scott Gray-2
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< >> [hidden email]> 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. >>> > |
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< >>> [hidden email]> 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. >>>> >> smime.p7s (3K) Download Attachment |
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< >>>> [hidden email]> 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. >>>>> >>> > |
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< >>>>> [hidden email]> 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. >>>>>> >>>> >> smime.p7s (3K) Download Attachment |
Free forum by Nabble | Edit this page |