jQuery mask + ILFormula questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

jQuery mask + ILFormula questions

thiago_sl
Hi list,

I am using masked-input-plugin, written in jQuery (http://
digitalbush.com/projects/masked-input-plugin) to some input mask in my
forms. I imported the js to my ILMemoryDirectory instance and call, in
my ILWidget:

scriptContents
        "Add some input masks"
          ^ [ :html |
                        html script: 'jQuery(function($){
                               $("#numeroNotaFiscal").focus();
    $("#data").mask("99/99/9999");
                                $("#number").mask("9?9999");
                                });'.
                ]

my questions:
1 - it works well with my ILWidgets, but i can´t see how to do that
with ILFormula (how add a script to it).
2 - is this the right way to add a script to my widgets ?

thank you.

Thiago Lino
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

sebastien audier
Hi Thiago,

Interesting, but if you need a date for example, why didn't you use ILDateInputField with formula ?

--
Sébastien AUDIER

ObjectFusion S.A.R.L.
Applications web, consulting, design
http://www.objectfusion.fr
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

Nicolas Petton
In reply to this post by thiago_sl
Le jeudi 24 mars 2011 à 15:39 -0700, Thiago SL a écrit :

> Hi list,
>
> I am using masked-input-plugin, written in jQuery (http://
> digitalbush.com/projects/masked-input-plugin) to some input mask in my
> forms. I imported the js to my ILMemoryDirectory instance and call, in
> my ILWidget:
>
> scriptContents
> "Add some input masks"
>  ^ [ :html |
> html script: 'jQuery(function($){
>       $("#numeroNotaFiscal").focus();
>     $("#data").mask("99/99/9999");
> $("#number").mask("9?9999");
> });'.
> ]
>
> my questions:
> 1 - it works well with my ILWidgets
Cool!

> , but i can´t see how to do that
> with ILFormula (how add a script to it).
You have to subclass ILField to do it.

> 2 - is this the right way to add a script to my widgets ?
Yes, except that you should create a subclass of ILMemoryDirectory
instead if using it directly.

Cheers,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

thiago_sl
In reply to this post by sebastien audier
Hi Nicolas an Sébastien,

On Mar 25, 5:36 am, sebastien audier <[hidden email]>
wrote:
> Hi Thiago,
>
> Interesting, but if you need a date for example, why didn't you use
> ILDateInputField with formula ?
>
I was using ILDateInputField, but i'm 'contaminated' by the model
"component_text_with_mask + mini_calendar".

Nicolas, let me explain. I imported the js to my ILMemoryDirectory
"extended" instance :D.
I get the idea about extend ILField, i will try.

thanks,
Thiago Lino
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

thiago_sl
In reply to this post by Nicolas Petton
Hi list.

On Mar 25, 6:13 am, Nicolas Petton <[hidden email]> wrote:
> Le jeudi 24 mars 2011 à 15:39 -0700, Thiago SL a écrit :
>

> > , but i can´t see how to do that
> > with ILFormula (how add a script to it).
>
> You have to subclass ILField to do it.
>

I create an ILField subclass to write a JQuery script to an ILFormula
(i named it ILScriptElement) and the script now is in the 'html'
generated, like expected. But now the problem: the ILField children
instances doesn't have an 'id', so my script is useless. I dont want
to change the ILField class, to put the id. Any idea?

thanks,
Thiago Lino
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

Nicolas Petton
Le samedi 26 mars 2011 à 06:55 -0700, Thiago SL a écrit :

> Hi list.
>
> On Mar 25, 6:13 am, Nicolas Petton <[hidden email]> wrote:
> > Le jeudi 24 mars 2011 à 15:39 -0700, Thiago SL a écrit :
> >
>
> > > , but i can´t see how to do that
> > > with ILFormula (how add a script to it).
> >
> > You have to subclass ILField to do it.
> >
>
> I create an ILField subclass to write a JQuery script to an ILFormula
> (i named it ILScriptElement) and the script now is in the 'html'
> generated, like expected. But now the problem: the ILField children
> instances doesn't have an 'id',
Do you mean the other fields or your custom field?
Do you need you custom fields to have an id or all fields in the form?

Cheers,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

thiago_sl
Hi Nicolas,
I need the id in all fields in the form.
For example:

formula := ILFormula on: anItem.
formula numberInputOn: #codigo.

then i created my component to put the script in the ILFormula:

formula addField: (ILScriptField on: formula script:'jQuery(function($)
{
                              $("#codigo").focus();
                                $("#codigo").mask("9?9999999");
                                });' ).

So i need to set the id in #codigo (or all ILField i want, in this
ILFormula)

On 26 mar, 11:27, Nicolas Petton <[hidden email]> wrote:

> Le samedi 26 mars 2011 à 06:55 -0700, Thiago SL a écrit :
>
>
> > On Mar 25, 6:13 am, Nicolas Petton <[hidden email]> wrote:
> > > Le jeudi 24 mars 2011 à 15:39 -0700, Thiago SL a écrit :
>
> > > > , but i can´t see how to do that
> > > > with ILFormula (how add a script to it).
>
> > > You have to subclass ILField to do it.
>
> > I create an ILField subclass to write a JQuery script to an ILFormula
> > (i named it ILScriptElement) and the script now is in the 'html'
> > generated, like expected. But now the problem: the ILField children
> > instances doesn't have an 'id',
>
> Do you mean the other fields or your custom field?
> Do you need you custom fields to have an id or all fields in the form?
>
Cheers,
Thiago Lino
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

Nicolas Petton
Fields ids are required in other situations anyway, so I suggest adding
ids to all fields.

What about:

formula := ILFormaula on: model.
input := formula inputOn: #foo.

"#fieldId answers teh id of a field. It is unique and rondomly
generated"
inputId := input fieldId.

Cheers,
Nico

Le samedi 26 mars 2011 à 07:40 -0700, Thiago SL a écrit :

> Hi Nicolas,
> I need the id in all fields in the form.
> For example:
>
> formula := ILFormula on: anItem.
> formula numberInputOn: #codigo.
>
> then i created my component to put the script in the ILFormula:
>
> formula addField: (ILScriptField on: formula script:'jQuery(function($)
> {
>      $("#codigo").focus();
> $("#codigo").mask("9?9999999");
> });' ).
>
> So i need to set the id in #codigo (or all ILField i want, in this
> ILFormula)
>
> On 26 mar, 11:27, Nicolas Petton <[hidden email]> wrote:
> > Le samedi 26 mars 2011 à 06:55 -0700, Thiago SL a écrit :
> >
> >
> > > On Mar 25, 6:13 am, Nicolas Petton <[hidden email]> wrote:
> > > > Le jeudi 24 mars 2011 à 15:39 -0700, Thiago SL a écrit :
> >
> > > > > , but i can´t see how to do that
> > > > > with ILFormula (how add a script to it).
> >
> > > > You have to subclass ILField to do it.
> >
> > > I create an ILField subclass to write a JQuery script to an ILFormula
> > > (i named it ILScriptElement) and the script now is in the 'html'
> > > generated, like expected. But now the problem: the ILField children
> > > instances doesn't have an 'id',
> >
> > Do you mean the other fields or your custom field?
> > Do you need you custom fields to have an id or all fields in the form?
> >
> Cheers,
> Thiago Lino


Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

thiago_sl
Hi Nicolas!
The id will be the selector name, or Iliad will generate a 'random' id
to the input?

On 28 mar, 05:16, Nicolas Petton <[hidden email]> wrote:

> Fields ids are required in other situations anyway, so I suggest adding
> ids to all fields.
>
> What about:
>
> formula := ILFormaula on: model.
> input := formula inputOn: #foo.
>
> "#fieldId answers teh id of a field. It is unique and rondomly
> generated"
> inputId := input fieldId.
>
> Cheers,
> Nico
>
> Le samedi 26 mars 2011 à 07:40 -0700, Thiago SL a écrit :
>
> > Hi Nicolas,
> > I need the id in all fields in the form.
> > For example:
>
> > formula := ILFormula on: anItem.
> > formula numberInputOn: #codigo.
>
> > then i created my component to put the script in the ILFormula:
>
> > formula addField: (ILScriptField on: formula script:'jQuery(function($)
> > {
> >                          $("#codigo").focus();
> >                            $("#codigo").mask("9?9999999");
> >                            });' ).
>
> > So i need to set the id in #codigo (or all ILField i want, in this
> > ILFormula)
>
> > On 26 mar, 11:27, Nicolas Petton <[hidden email]> wrote:
> > > Le samedi 26 mars 2011 à 06:55 -0700, Thiago SL a écrit :
>
> > > > On Mar 25, 6:13 am, Nicolas Petton <[hidden email]> wrote:
> > > > > Le jeudi 24 mars 2011 à 15:39 -0700, Thiago SL a écrit :
>
> > > > > > , but i can´t see how to do that
> > > > > > with ILFormula (how add a script to it).
>
> > > > > You have to subclass ILField to do it.
>
> > > > I create an ILField subclass to write a JQuery script to an ILFormula
> > > > (i named it ILScriptElement) and the script now is in the 'html'
> > > > generated, like expected. But now the problem: the ILField children
> > > > instances doesn't have an 'id',
>
> > > Do you mean the other fields or your custom field?
> > > Do you need you custom fields to have an id or all fields in the form?
>
> > Cheers,
> > Thiago Lino
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

Nicolas Petton
Le lundi 28 mars 2011 à 04:51 -0700, Thiago SL a écrit :
> The id will be the selector name, or Iliad will generate a 'random' id
> to the input?

Since an id must be unique, it will be a random one. But is it a problem
if you can access it throught "aField id" ?

Cheers,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

thiago_sl
No, i cant see anyone.
Maybe if i want to use Selenium, to test the aplication, i dont know
how it works with a dynamic id.
Will you generate the release 0.9.2 today, with this feature? ;)

Cheers,
Thiago Lino

On 28 mar, 09:11, Nicolas Petton <[hidden email]> wrote:

> Le lundi 28 mars 2011 à 04:51 -0700, Thiago SL a écrit :
>
> > The id will be the selector name, or Iliad will generate a 'random' id
> > to the input?
>
> Since an id must be unique, it will be a random one. But is it a problem
> if you can access it throught "aField id" ?
>
> Cheers,
> Nico
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

sebastien audier

No, i cant see anyone.
Maybe if i want to use Selenium, to test the aplication, i dont know
how it works with a dynamic id.


With Selenium, you can use class or attributes in order to select the right element.
You can select elements like this too:

selenium ...   /a[2]/div[class='something']/a[3] ... etc ...

It will answer: 

the third anchor in a div with class 'something' and which is in the second anchor.

If element exist of course !


--
Sébastien AUDIER

ObjectFusion S.A.R.L.
Applications web, consulting, design
http://www.objectfusion.fr
Reply | Threaded
Open this post in threaded view
|

Re: jQuery mask + ILFormula questions

thiago_sl
Hi Sebastien!
OK, i am waiting for Nicolas, he is generating the release 0.9.2,
just right now :D

Now seriously, thanks for the help. I can use Selenium like Sebastien
suggested.


On 28 mar, 09:43, sebastien audier <[hidden email]> wrote:

> > No, i cant see anyone.
> > Maybe if i want to use Selenium, to test the aplication, i dont know
> > how it works with a dynamic id.
>
> With Selenium, you can use class or attributes in order to select the right
> element.
> You can select elements like this too:
>
> selenium ...   /a[2]/div[class='something']/a[3] ... etc ...
>
> It will answer:
>
> the third anchor in a div with class 'something' and which is in the second
> anchor.
>
> If element exist of course !
>
> --
> Sébastien AUDIER
>
> ObjectFusion S.A.R.L.
> Applications web, consulting, designhttp://www.objectfusion.fr