Re: Passing parametre
Murat Günana <[email protected]> Wed, 4 Dec 2013 12:54:36 +0000
| Newsgroups | gmane.comp.php.drupal.devel |
|---|---|
| Message-ID | <CABVr5nJeEQDSF3pwJK1XGUU-isDGaEY95z=MRYOsxbKe9Sp97g@mail.gmail.com> |
--f46d0442816a579c7404ecb4ea7a
Content-Type: text/plain; charset=ISO-8859-1
implement your form submit element like;
$form['actions']['submit'] = array(
'#type' => 'button',
'#value' => t('Submit'),
'#submit' => array('night_pharmacy_table'),
);
and make sure you clear the cache.
On 4 December 2013 12:49, Muzaffer Tolga Ozses <[email protected]> wrote:
> Thanks Patrick,
>
> Unfortunately, night_pharmacy_table never gets called, and I have no clue
> why. Do you happen to have an idea?
>
>
> On 4 December 2013 14:35, Patrick Dawkins <[email protected]> wrote:
>
>> night_pharmacy_table is a form submit callback. It already gets passed
>> the $form parameter; you have got the function signature wrong.
>>
>> So you need to change
>> function night_pharmacy_table($form_state) {
>> to
>> function night_pharmacy_table($form, &$form_state) {
>>
>>
>> Documentation here:
>> https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#submit_property
>>
>>
>>
>>
>> On 4 December 2013 12:14, Muzaffer Tolga Ozses <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> This is really a PHP question, but it involves $form_state, so bear with
>>> me please.
>>>
>>> In my code at
>>> http://git.webciniz.im/?p=project/night_pharmacy.git;a=blob;f=night_pharmacy.module;h=132b5d4a90692acfadfe9e11af128f712df1c24d;hb=e89e63bb07f064898ca21be1c97aba221b4dbdaf#l57I want to be able to pass $form parameters to night_pharmacy_table, to no
>>> avail. Can you help me guys?
>>>
>>> Thanks in advance :)
>>>
>>
>>
>
--
Kind regards,
Murat Gunana
Tel: 07927964976
Email: [email protected]
--f46d0442816a579c7404ecb4ea7a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>implement your form submit element like;<br>$form[=
9;actions']['submit'] =3D array(<br>=A0=A0=A0=A0 '#type'=
; =3D> 'button',<br>=A0=A0=A0=A0 '#value' =3D> t('=
;Submit'),<br>=A0=A0=A0=A0 '#submit' =3D> array('night_p=
harmacy_table'),<br>
=A0=A0 );<br></div>and make sure you clear the cache.<br></div><div class=
=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On 4 December 2013 12:4=
9, Muzaffer Tolga Ozses <span dir=3D"ltr"><<a href=3D"mailto:tolga@ozses=
.net" target=3D"_blank">[email protected]</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_default=
" style=3D"font-family:courier new,monospace">Thanks Patrick,</div><div cla=
ss=3D"gmail_default" style=3D"font-family:courier new,monospace">
<br></div><div class=3D"gmail_default" style=3D"font-family:courier new,mon=
ospace">
Unfortunately, night_pharmacy_table never gets called, and I have no clue w=
hy. Do you happen to have an idea?</div><div><div class=3D"h5"><div class=
=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On 4 December 2013 14:3=
5, Patrick Dawkins <span dir=3D"ltr"><<a href=3D"mailto:pjcdawkins@gmail=
.com" target=3D"_blank">[email protected]</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">night_pharmacy_table is a f=
orm submit callback. It already gets passed the $form parameter; you have g=
ot the function signature wrong.<div>
<br></div><div><div>So you need to change<div><div>function night_pharmacy_=
table($form_state) {</div>
<div>to</div><div>function night_pharmacy_table($form, &$form_state) {<=
/div></div></div><div><br></div><div><br></div><div>Documentation here:=A0<=
a href=3D"https://api.drupal.org/api/drupal/developer!topics!forms_api_refe=
rence.html/7#submit_property" target=3D"_blank">https://api.drupal.org/api/=
drupal/developer!topics!forms_api_reference.html/7#submit_property</a><div>
<br></div></div><div><br></div></div></div><div><div><div class=3D"gmail_ex=
tra"><br><br><div class=3D"gmail_quote">On 4 December 2013 12:14, Muzaffer =
Tolga Ozses <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_default=
" style=3D"font-family:'courier new',monospace">Hi,</div><div class=
=3D"gmail_default" style=3D"font-family:'courier new',monospace">
<br></div><div class=3D"gmail_default" style=3D"font-family:'courier ne=
w',monospace">
This is really a PHP question, but it involves $form_state, so bear with me=
please.</div><div class=3D"gmail_default" style=3D"font-family:'courie=
r new',monospace"><br></div><div class=3D"gmail_default" style=3D"font-=
family:'courier new',monospace">
In my code at=A0<a href=3D"http://git.webciniz.im/?p=3Dproject/night_pharma=
cy.git;a=3Dblob;f=3Dnight_pharmacy.module;h=3D132b5d4a90692acfadfe9e11af128=
f712df1c24d;hb=3De89e63bb07f064898ca21be1c97aba221b4dbdaf#l57" target=3D"_b=
lank">http://git.webciniz.im/?p=3Dproject/night_pharmacy.git;a=3Dblob;f=3Dn=
ight_pharmacy.module;h=3D132b5d4a90692acfadfe9e11af128f712df1c24d;hb=3De89e=
63bb07f064898ca21be1c97aba221b4dbdaf#l57</a> I want to be able to pass $for=
m parameters to night_pharmacy_table, to no avail. Can you help me guys?</d=
iv>
<div class=3D"gmail_default" style=3D"font-family:'courier new',mon=
ospace"><br></div><div class=3D"gmail_default" style=3D"font-family:'co=
urier new',monospace">Thanks in advance :)</div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear=3D"all"><br>-- <br>Kind regards,<br><br>Mu=
rat Gunana<br>Tel: 07927964976<br>Email: <a href=3D"mailto:[email protected]=
m" target=3D"_blank">[email protected]</a><br>
</div>
--f46d0442816a579c7404ecb4ea7a--