You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Avijit Bose <bo...@gmail.com> on 2022/08/07 05:27:45 UTC

JQuery validation in ofbiz

Hello,

It seems that currently ofbiz 18.12.05 is using jquery version 3.5.1.

Question 1: How do I use jquery validation in ftl forms?

Question 2: How do I upgrade the jquery version to the latest version?

regards
Avijit

Re: JQuery validation in ofbiz

Posted by Aditya Sharma <ad...@apache.org>.
Hello Avijit,

Checkout the markup on EditExampleFeature page by inspecting (dev tools):
https://demo-stable.ofbiz.apache.org/example/control/EditExampleFeature

<! -- Added class
*requireValidation -->*
<form method="post" action="/example/control/createExampleFeature"
id="EditExampleFeature" class="basic-form *requireValidation*"
onsubmit="javascript:submitFormDisableSubmits(this)"
name="EditExampleFeature" novalidate="novalidate">
<label for="EditExampleFeature_description"
id="EditExampleFeature_description_title">Description</label>  </td>

<! -- Added class
*required -->*
<input type="text" name="description" class="required error" size="60"
maxlength="250" id="EditExampleFeature_description" require=""
aria-invalid="true">
<! -- *Error message -->*
<label id="EditExampleFeature_description-error" class="error"
for="EditExampleFeature_description">This field is required.</label>  *
<input type="submit" name="submitButton" value="Create" class="">
</form>


Follow JQuery Validation official documentation:
https://jqueryvalidation.org/documentation/

Refer demo:
https://jqueryvalidation.org/files/demo/marketo/

HTH

Thanks and Regards,
Aditya Sharma



On Mon, Aug 8, 2022 at 7:26 PM Avijit Bose <bo...@gmail.com> wrote:

> Hi Aditya,
>
> Could you pls clarify more by giving an example if possible?
>
> regards
> Avijit
>
> On Mon, Aug 8, 2022 at 10:38 AM Aditya Sharma <ad...@apache.org>
> wrote:
>
> > Hello Avijit,
> >
> > >> Question 1: How do I use jquery validation in ftl forms?
> > Add class requireValidation to form
> >
> > Reference implementation of form macro:
> >
> >
> https://github.com/apache/ofbiz-framework/blob/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl#L247
> >
> > Implementation that initialises the validate plugin on form:
> >
> >
> https://github.com/apache/ofbiz-framework/blob/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js#L259
> >
> >
> >
> > >> Question 2: How do I upgrade the jquery version to the latest version?
> > You need to download and replace files here
> >
> >
> https://github.com/apache/ofbiz-framework/tree/release18.12/themes/common-theme/webapp/common/js/jquery/plugins/validate
> >
> >
> > HTH
> >
> > Thanks and Regards,
> > Aditya Sharma
> >
> > On Sun, Aug 7, 2022 at 10:58 AM Avijit Bose <bo...@gmail.com>
> wrote:
> >
> > > Hello,
> > >
> > > It seems that currently ofbiz 18.12.05 is using jquery version 3.5.1.
> > >
> > > Question 1: How do I use jquery validation in ftl forms?
> > >
> > > Question 2: How do I upgrade the jquery version to the latest version?
> > >
> > > regards
> > > Avijit
> > >
> >
>

Re: JQuery validation in ofbiz

Posted by Avijit Bose <bo...@gmail.com>.
Hi Aditya,

Could you pls clarify more by giving an example if possible?

regards
Avijit

On Mon, Aug 8, 2022 at 10:38 AM Aditya Sharma <ad...@apache.org>
wrote:

> Hello Avijit,
>
> >> Question 1: How do I use jquery validation in ftl forms?
> Add class requireValidation to form
>
> Reference implementation of form macro:
>
> https://github.com/apache/ofbiz-framework/blob/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl#L247
>
> Implementation that initialises the validate plugin on form:
>
> https://github.com/apache/ofbiz-framework/blob/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js#L259
>
>
>
> >> Question 2: How do I upgrade the jquery version to the latest version?
> You need to download and replace files here
>
> https://github.com/apache/ofbiz-framework/tree/release18.12/themes/common-theme/webapp/common/js/jquery/plugins/validate
>
>
> HTH
>
> Thanks and Regards,
> Aditya Sharma
>
> On Sun, Aug 7, 2022 at 10:58 AM Avijit Bose <bo...@gmail.com> wrote:
>
> > Hello,
> >
> > It seems that currently ofbiz 18.12.05 is using jquery version 3.5.1.
> >
> > Question 1: How do I use jquery validation in ftl forms?
> >
> > Question 2: How do I upgrade the jquery version to the latest version?
> >
> > regards
> > Avijit
> >
>

Re: JQuery validation in ofbiz

Posted by Aditya Sharma <ad...@apache.org>.
Hello Avijit,

>> Question 1: How do I use jquery validation in ftl forms?
Add class requireValidation to form

Reference implementation of form macro:
https://github.com/apache/ofbiz-framework/blob/release18.12/themes/common-theme/template/macro/HtmlFormMacroLibrary.ftl#L247

Implementation that initialises the validate plugin on form:
https://github.com/apache/ofbiz-framework/blob/release18.12/themes/common-theme/webapp/common/js/util/OfbizUtil.js#L259



>> Question 2: How do I upgrade the jquery version to the latest version?
You need to download and replace files here
https://github.com/apache/ofbiz-framework/tree/release18.12/themes/common-theme/webapp/common/js/jquery/plugins/validate


HTH

Thanks and Regards,
Aditya Sharma

On Sun, Aug 7, 2022 at 10:58 AM Avijit Bose <bo...@gmail.com> wrote:

> Hello,
>
> It seems that currently ofbiz 18.12.05 is using jquery version 3.5.1.
>
> Question 1: How do I use jquery validation in ftl forms?
>
> Question 2: How do I upgrade the jquery version to the latest version?
>
> regards
> Avijit
>