From: zia mohaddes on
Hello everyone,

I am currently using php quickform to create form elements( buttons, text,
etc...) . However I intend to combine these elements with javascript but I
am not sure if there php quickform provides the ability of incorporating
javascript into the form.

I would highly appreciate if anyone can give me some insights as to how I
could proceed!

Thank you kindly for the help in advance!

regards,

daniel
From: Mark Steudel on
Short answer is yes.

There are a couple of ways you could do this:

1. Add event directly to element

e.g. <input type="text" onclick="dosomething();" name="test" id="test" />

could be done in QuickForm like

$form->addElement( 'text', 'test', 'My Label', array( 'onclick' =>
'dosomething();', 'id' => 'test' ) );

2. Use a framework like jquery to add events too your form elements

So to do the above example you'd probably do something like

$form->addElement( 'text', 'test', 'My Label', array( 'id' => 'test' ) );

$("#test").click( function() {
alert( 'i was clicked');
});

Hope that gets you going.

Mark
On Fri, Mar 12, 2010 at 1:42 PM, zia mohaddes <zia.simab(a)gmail.com> wrote:
> Hello everyone,
>
> I am currently using php quickform to create form elements( buttons, text,
> etc...) . However I intend to combine these elements with javascript but I
> am not sure if there php quickform provides the ability of incorporating
> javascript into the form.
>
> I would highly appreciate if anyone can give me some insights as to how I
> could proceed!
>
> Thank you kindly for the help in advance!
>
> regards,
>
> daniel
>



--

-----------------------------------------
Mark Steudel
P: 206.375.7244
msteudel(a)gmail.com

.. : Work : .
http://www.mindfulinteractive.com

.. : Play : .
http://www.steudel.org/blog
From: Mark Steudel on
And to clarify this part:

$("#test").click( function() {
alert( 'i was clicked');
});

Is jquery, not quickform.

MS

2010/3/12 Mark Steudel <msteudel(a)gmail.com>:
> Short answer is yes.
>
> There are a couple of ways you could do this:
>
> 1. Add event directly to element
>
> e.g. <input type="text" onclick="dosomething();" name="test" id="test" />
>
> could be done in QuickForm like
>
> $form->addElement( 'text', 'test', 'My Label', array( 'onclick' => 'dosomething();', 'id' => 'test' ) );
>
> 2. Use a framework like jquery to add events too your form elements
>
> So to do the above example you'd probably do something like
>
> $form->addElement( 'text', 'test', 'My Label', array( 'id' => 'test' ) );
>
> $("#test").click( function() {
> alert( 'i was clicked');
> });
>
> Hope that gets you going.
>
> Mark
> On Fri, Mar 12, 2010 at 1:42 PM, zia mohaddes <zia.simab(a)gmail.com> wrote:
>> Hello everyone,
>>
>> I am currently using php quickform to create form elements( buttons, text,
>> etc...) . However I intend to combine these elements with javascript but I
>> am not sure if there php quickform provides the ability of incorporating
>> javascript into the form.
>>
>> I would highly appreciate if anyone can give me some insights as to how I
>> could proceed!
>>
>> Thank you kindly for the help in advance!
>>
>> regards,
>>
>> daniel
>>
>
>
>
> --
>
> -----------------------------------------
> Mark Steudel
> P: 206.375.7244
> msteudel(a)gmail.com
>
> . : Work : .
> http://www.mindfulinteractive.com
>
> . : Play : .
> http://www.steudel.org/blog
>
>
>
>



--

-----------------------------------------
Mark Steudel
P: 206.375.7244
msteudel(a)gmail.com

.. : Work : .
http://www.mindfulinteractive.com

.. : Play : .
http://www.steudel.org/blog
From: zia mohaddes on
Hey Mark,

Thank you so much for the answer! I will use this to build more complicated
functions. Hopefully it'll work!

regards,

daniel

On Fri, Mar 12, 2010 at 6:57 PM, Mark Steudel <msteudel(a)gmail.com> wrote:

> Short answer is yes.
>
> There are a couple of ways you could do this:
>
> 1. Add event directly to element
>
> e.g. <input type="text" onclick="dosomething();" name="test" id="test" />
>
> could be done in QuickForm like
>
> $form->addElement( 'text', 'test', 'My Label', array( 'onclick' =>
> 'dosomething();', 'id' => 'test' ) );
>
> 2. Use a framework like jquery to add events too your form elements
>
> So to do the above example you'd probably do something like
>
> $form->addElement( 'text', 'test', 'My Label', array( 'id' => 'test' ) );
>
> $("#test").click( function() {
> alert( 'i was clicked');
> });
>
> Hope that gets you going.
>
> Mark
> On Fri, Mar 12, 2010 at 1:42 PM, zia mohaddes <zia.simab(a)gmail.com> wrote:
> > Hello everyone,
> >
> > I am currently using php quickform to create form elements( buttons,
> text,
> > etc...) . However I intend to combine these elements with javascript but
> I
> > am not sure if there php quickform provides the ability of incorporating
> > javascript into the form.
> >
> > I would highly appreciate if anyone can give me some insights as to how I
> > could proceed!
> >
> > Thank you kindly for the help in advance!
> >
> > regards,
> >
> > daniel
> >
>
>
>
> --
>
> -----------------------------------------
> Mark Steudel
> P: 206.375.7244
> msteudel(a)gmail.com
>
> . : Work : .
> http://www.mindfulinteractive.com
>
> . : Play : .
> http://www.steudel.org/blog
>