You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Ian Duffy <ia...@ianduffy.ie> on 2013/07/22 15:51:03 UTC

UI Query: createForm

Hi,

I'm having an issue with the below gisted snippets. For whatever
reason they do not get validated. Any idea why?

https://gist.github.com/imduffy15/6053967

Thanks,
Ian

Re: UI Query: createForm

Posted by Ian Duffy <ia...@ianduffy.ie>.
Cool thanks guys. Any reason why required wasn't appended as a class along
with disallowSpecialCharachers when required:true was set?
On 25 Jul 2013 18:28, "Pranav Saxena" <ps...@gmail.com> wrote:

> Yes Ian , Jessica's right. That's why I had suggested the previous
> workaround because Jquery doesn't check CSS class of labels.
>
>
> On Thu, Jul 25, 2013 at 10:23 PM, Jessica Wang <Je...@citrix.com>wrote:
>
>> Ian,
>>
>> That's correct.
>>
>> JQuery Validation only checks CSS class("disallowSpecialCharacters" in
>> this case) of input field.
>> It doesn't check CSS class of label.
>>
>> Jessica
>>
>> -----Original Message-----
>> From: Ian Duffy [mailto:ian@ianduffy.ie]
>> Sent: Thursday, July 25, 2013 6:02 AM
>> To: dev@cloudstack.apache.org
>> Subject: Re: UI Query: createForm
>>
>> Hi,
>>
>> Looking at this again.
>>
>> It works if I add a class of required onto the input tag. For some
>> reason it doesn't pick up the field-required from the label.
>>
>> On 24 July 2013 14:08, Ian Duffy <ia...@ianduffy.ie> wrote:
>> > Hi Pranav,
>> >
>> > The "Required: true" in the creates that span required field
>> > automatically. The following is the result of its generated html:
>> > (Just using account as an example, account isn't required in practice)
>> >
>> > <div class="form-item" rel="account">
>> >     <div class="name">
>> >         <label for="label_account">
>> >             <span class="field-required">*</span>Account:</label>
>> >     </div>
>> >     <div class="value">
>> >         <input name="account" type="text"
>> > class="disallowSpecialCharacters" id="label_account">
>> >     </div>
>> > </div>
>> >
>> > But it still allows the form to be submitted without account having
>> data.
>> >
>> > On 24 July 2013 13:48, Pranav Saxena <ps...@gmail.com> wrote:
>> >> Sorry for missing this thread .Seems like the mail was automatically
>> sent
>> >> to my citrix ID which doesn't exist anymore. Anyways, I gave a quick
>> look
>> >> at what Ian is trying to do here and realized that he has probably
>> >> forgotten to add the "required" class in the form structure . Ian , you
>> >> might want to add something like this to your customized form  as shown
>> >> below . This might help you with form validation.
>> >>
>> >> var $astersikSpan = $('<span>').addClass('field-required').html('*');
>> >> <
>> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l174
>> >
>> >>                 $name.find('label').prepend($astersikSpan);
>> >> <
>> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l175
>> >
>> >> <
>> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l176
>> >
>> >>                if (field.validation == null ||
>> >> field.validation.required == false) {
>> >> <
>> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l177
>> >
>> >>                     $astersikSpan.hide();
>> >> <
>> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l178
>> >
>> >>               }
>> >>
>> >>
>> >> Thanks,
>> >> Pranav
>> >>
>> >>
>> >>
>> >>
>> >> On Wed, Jul 24, 2013 at 5:55 PM, Sebastien Goasguen <runseb@gmail.com
>> >wrote:
>> >>
>> >>> Parnav, Jessica or Brian, can you help Ian here ?
>> >>>
>> >>> thx
>> >>>
>> >>> On Jul 22, 2013, at 9:51 AM, Ian Duffy <ia...@ianduffy.ie> wrote:
>> >>>
>> >>> > Hi,
>> >>> >
>> >>> > I'm having an issue with the below gisted snippets. For whatever
>> >>> > reason they do not get validated. Any idea why?
>> >>> >
>> >>> > https://gist.github.com/imduffy15/6053967
>> >>> >
>> >>> > Thanks,
>> >>> > Ian
>> >>>
>> >>>
>>
>
>

Re: UI Query: createForm

Posted by Pranav Saxena <ps...@gmail.com>.
Yes Ian , Jessica's right. That's why I had suggested the previous
workaround because Jquery doesn't check CSS class of labels.


On Thu, Jul 25, 2013 at 10:23 PM, Jessica Wang <Je...@citrix.com>wrote:

> Ian,
>
> That's correct.
>
> JQuery Validation only checks CSS class("disallowSpecialCharacters" in
> this case) of input field.
> It doesn't check CSS class of label.
>
> Jessica
>
> -----Original Message-----
> From: Ian Duffy [mailto:ian@ianduffy.ie]
> Sent: Thursday, July 25, 2013 6:02 AM
> To: dev@cloudstack.apache.org
> Subject: Re: UI Query: createForm
>
> Hi,
>
> Looking at this again.
>
> It works if I add a class of required onto the input tag. For some
> reason it doesn't pick up the field-required from the label.
>
> On 24 July 2013 14:08, Ian Duffy <ia...@ianduffy.ie> wrote:
> > Hi Pranav,
> >
> > The "Required: true" in the creates that span required field
> > automatically. The following is the result of its generated html:
> > (Just using account as an example, account isn't required in practice)
> >
> > <div class="form-item" rel="account">
> >     <div class="name">
> >         <label for="label_account">
> >             <span class="field-required">*</span>Account:</label>
> >     </div>
> >     <div class="value">
> >         <input name="account" type="text"
> > class="disallowSpecialCharacters" id="label_account">
> >     </div>
> > </div>
> >
> > But it still allows the form to be submitted without account having data.
> >
> > On 24 July 2013 13:48, Pranav Saxena <ps...@gmail.com> wrote:
> >> Sorry for missing this thread .Seems like the mail was automatically
> sent
> >> to my citrix ID which doesn't exist anymore. Anyways, I gave a quick
> look
> >> at what Ian is trying to do here and realized that he has probably
> >> forgotten to add the "required" class in the form structure . Ian , you
> >> might want to add something like this to your customized form  as shown
> >> below . This might help you with form validation.
> >>
> >> var $astersikSpan = $('<span>').addClass('field-required').html('*');
> >> <
> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l174
> >
> >>                 $name.find('label').prepend($astersikSpan);
> >> <
> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l175
> >
> >> <
> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l176
> >
> >>                if (field.validation == null ||
> >> field.validation.required == false) {
> >> <
> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l177
> >
> >>                     $astersikSpan.hide();
> >> <
> https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l178
> >
> >>               }
> >>
> >>
> >> Thanks,
> >> Pranav
> >>
> >>
> >>
> >>
> >> On Wed, Jul 24, 2013 at 5:55 PM, Sebastien Goasguen <runseb@gmail.com
> >wrote:
> >>
> >>> Parnav, Jessica or Brian, can you help Ian here ?
> >>>
> >>> thx
> >>>
> >>> On Jul 22, 2013, at 9:51 AM, Ian Duffy <ia...@ianduffy.ie> wrote:
> >>>
> >>> > Hi,
> >>> >
> >>> > I'm having an issue with the below gisted snippets. For whatever
> >>> > reason they do not get validated. Any idea why?
> >>> >
> >>> > https://gist.github.com/imduffy15/6053967
> >>> >
> >>> > Thanks,
> >>> > Ian
> >>>
> >>>
>

RE: UI Query: createForm

Posted by Jessica Wang <Je...@citrix.com>.
Ian,

That's correct.

JQuery Validation only checks CSS class("disallowSpecialCharacters" in this case) of input field.
It doesn't check CSS class of label.

Jessica

-----Original Message-----
From: Ian Duffy [mailto:ian@ianduffy.ie] 
Sent: Thursday, July 25, 2013 6:02 AM
To: dev@cloudstack.apache.org
Subject: Re: UI Query: createForm

Hi,

Looking at this again.

It works if I add a class of required onto the input tag. For some
reason it doesn't pick up the field-required from the label.

On 24 July 2013 14:08, Ian Duffy <ia...@ianduffy.ie> wrote:
> Hi Pranav,
>
> The "Required: true" in the creates that span required field
> automatically. The following is the result of its generated html:
> (Just using account as an example, account isn't required in practice)
>
> <div class="form-item" rel="account">
>     <div class="name">
>         <label for="label_account">
>             <span class="field-required">*</span>Account:</label>
>     </div>
>     <div class="value">
>         <input name="account" type="text"
> class="disallowSpecialCharacters" id="label_account">
>     </div>
> </div>
>
> But it still allows the form to be submitted without account having data.
>
> On 24 July 2013 13:48, Pranav Saxena <ps...@gmail.com> wrote:
>> Sorry for missing this thread .Seems like the mail was automatically sent
>> to my citrix ID which doesn't exist anymore. Anyways, I gave a quick look
>> at what Ian is trying to do here and realized that he has probably
>> forgotten to add the "required" class in the form structure . Ian , you
>> might want to add something like this to your customized form  as shown
>> below . This might help you with form validation.
>>
>> var $astersikSpan = $('<span>').addClass('field-required').html('*');
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l174>
>>                 $name.find('label').prepend($astersikSpan);
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l175>
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l176>
>>                if (field.validation == null ||
>> field.validation.required == false) {
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l177>
>>                     $astersikSpan.hide();
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l178>
>>               }
>>
>>
>> Thanks,
>> Pranav
>>
>>
>>
>>
>> On Wed, Jul 24, 2013 at 5:55 PM, Sebastien Goasguen <ru...@gmail.com>wrote:
>>
>>> Parnav, Jessica or Brian, can you help Ian here ?
>>>
>>> thx
>>>
>>> On Jul 22, 2013, at 9:51 AM, Ian Duffy <ia...@ianduffy.ie> wrote:
>>>
>>> > Hi,
>>> >
>>> > I'm having an issue with the below gisted snippets. For whatever
>>> > reason they do not get validated. Any idea why?
>>> >
>>> > https://gist.github.com/imduffy15/6053967
>>> >
>>> > Thanks,
>>> > Ian
>>>
>>>

Re: UI Query: createForm

Posted by Ian Duffy <ia...@ianduffy.ie>.
Hi,

Looking at this again.

It works if I add a class of required onto the input tag. For some
reason it doesn't pick up the field-required from the label.

On 24 July 2013 14:08, Ian Duffy <ia...@ianduffy.ie> wrote:
> Hi Pranav,
>
> The "Required: true" in the creates that span required field
> automatically. The following is the result of its generated html:
> (Just using account as an example, account isn't required in practice)
>
> <div class="form-item" rel="account">
>     <div class="name">
>         <label for="label_account">
>             <span class="field-required">*</span>Account:</label>
>     </div>
>     <div class="value">
>         <input name="account" type="text"
> class="disallowSpecialCharacters" id="label_account">
>     </div>
> </div>
>
> But it still allows the form to be submitted without account having data.
>
> On 24 July 2013 13:48, Pranav Saxena <ps...@gmail.com> wrote:
>> Sorry for missing this thread .Seems like the mail was automatically sent
>> to my citrix ID which doesn't exist anymore. Anyways, I gave a quick look
>> at what Ian is trying to do here and realized that he has probably
>> forgotten to add the "required" class in the form structure . Ian , you
>> might want to add something like this to your customized form  as shown
>> below . This might help you with form validation.
>>
>> var $astersikSpan = $('<span>').addClass('field-required').html('*');
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l174>
>>                 $name.find('label').prepend($astersikSpan);
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l175>
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l176>
>>                if (field.validation == null ||
>> field.validation.required == false) {
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l177>
>>                     $astersikSpan.hide();
>> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l178>
>>               }
>>
>>
>> Thanks,
>> Pranav
>>
>>
>>
>>
>> On Wed, Jul 24, 2013 at 5:55 PM, Sebastien Goasguen <ru...@gmail.com>wrote:
>>
>>> Parnav, Jessica or Brian, can you help Ian here ?
>>>
>>> thx
>>>
>>> On Jul 22, 2013, at 9:51 AM, Ian Duffy <ia...@ianduffy.ie> wrote:
>>>
>>> > Hi,
>>> >
>>> > I'm having an issue with the below gisted snippets. For whatever
>>> > reason they do not get validated. Any idea why?
>>> >
>>> > https://gist.github.com/imduffy15/6053967
>>> >
>>> > Thanks,
>>> > Ian
>>>
>>>

Re: UI Query: createForm

Posted by Ian Duffy <ia...@ianduffy.ie>.
Hi Pranav,

The "Required: true" in the creates that span required field
automatically. The following is the result of its generated html:
(Just using account as an example, account isn't required in practice)

<div class="form-item" rel="account">
    <div class="name">
        <label for="label_account">
            <span class="field-required">*</span>Account:</label>
    </div>
    <div class="value">
        <input name="account" type="text"
class="disallowSpecialCharacters" id="label_account">
    </div>
</div>

But it still allows the form to be submitted without account having data.

On 24 July 2013 13:48, Pranav Saxena <ps...@gmail.com> wrote:
> Sorry for missing this thread .Seems like the mail was automatically sent
> to my citrix ID which doesn't exist anymore. Anyways, I gave a quick look
> at what Ian is trying to do here and realized that he has probably
> forgotten to add the "required" class in the form structure . Ian , you
> might want to add something like this to your customized form  as shown
> below . This might help you with form validation.
>
> var $astersikSpan = $('<span>').addClass('field-required').html('*');
> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l174>
>                 $name.find('label').prepend($astersikSpan);
> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l175>
> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l176>
>                if (field.validation == null ||
> field.validation.required == false) {
> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l177>
>                     $astersikSpan.hide();
> <https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l178>
>               }
>
>
> Thanks,
> Pranav
>
>
>
>
> On Wed, Jul 24, 2013 at 5:55 PM, Sebastien Goasguen <ru...@gmail.com>wrote:
>
>> Parnav, Jessica or Brian, can you help Ian here ?
>>
>> thx
>>
>> On Jul 22, 2013, at 9:51 AM, Ian Duffy <ia...@ianduffy.ie> wrote:
>>
>> > Hi,
>> >
>> > I'm having an issue with the below gisted snippets. For whatever
>> > reason they do not get validated. Any idea why?
>> >
>> > https://gist.github.com/imduffy15/6053967
>> >
>> > Thanks,
>> > Ian
>>
>>

Re: UI Query: createForm

Posted by Pranav Saxena <ps...@gmail.com>.
Sorry for missing this thread .Seems like the mail was automatically sent
to my citrix ID which doesn't exist anymore. Anyways, I gave a quick look
at what Ian is trying to do here and realized that he has probably
forgotten to add the "required" class in the form structure . Ian , you
might want to add something like this to your customized form  as shown
below . This might help you with form validation.

var $astersikSpan = $('<span>').addClass('field-required').html('*');
<https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l174>
                $name.find('label').prepend($astersikSpan);
<https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l175>
<https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l176>
               if (field.validation == null ||
field.validation.required == false) {
<https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l177>
                    $astersikSpan.hide();
<https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=blob;f=ui/scripts/ui/dialog.js;h=eb7e7b2acb09af4a9d6522949414b50cd18702f6;hb=ad69bc8d#l178>
              }


Thanks,
Pranav




On Wed, Jul 24, 2013 at 5:55 PM, Sebastien Goasguen <ru...@gmail.com>wrote:

> Parnav, Jessica or Brian, can you help Ian here ?
>
> thx
>
> On Jul 22, 2013, at 9:51 AM, Ian Duffy <ia...@ianduffy.ie> wrote:
>
> > Hi,
> >
> > I'm having an issue with the below gisted snippets. For whatever
> > reason they do not get validated. Any idea why?
> >
> > https://gist.github.com/imduffy15/6053967
> >
> > Thanks,
> > Ian
>
>

Re: UI Query: createForm

Posted by Sebastien Goasguen <ru...@gmail.com>.
Parnav, Jessica or Brian, can you help Ian here ?

thx

On Jul 22, 2013, at 9:51 AM, Ian Duffy <ia...@ianduffy.ie> wrote:

> Hi,
> 
> I'm having an issue with the below gisted snippets. For whatever
> reason they do not get validated. Any idea why?
> 
> https://gist.github.com/imduffy15/6053967
> 
> Thanks,
> Ian