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" <psb...@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 <jessica.w...@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:i...@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 <i...@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 <psb...@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 <run...@gmail.com >> >wrote: >> >> >> >>> Parnav, Jessica or Brian, can you help Ian here ? >> >>> >> >>> thx >> >>> >> >>> On Jul 22, 2013, at 9:51 AM, Ian Duffy <i...@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 >> >>> >> >>> >> > >