Re: Passing parametre
Muzaffer Tolga Ozses <[email protected]> Wed, 4 Dec 2013 16:46:05 +0200
| Newsgroups | gmane.comp.php.drupal.devel |
|---|---|
| Message-ID | <CAMAQ3nK3FqqCL+M=LDz_SZMu7tAvPKcUhZ7E0xbuFFFGxXF-Fw@mail.gmail.com> |
--f46d043bdfa20031ae04ecb679c3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable So, what else can I check? On 4 December 2013 15:24, Murat G=FCnana <[email protected]> wrote: > According to the form api it should be able to do that. > > > On 4 December 2013 13:17, John Morahan <[email protected]> wrote: > >> '#type' =3D> 'button' won't execute a submit callback, try '#type' =3D> >> 'submit' >> >> >> On 4 December 2013 13:16, Murat G=FCnana <[email protected]> wrote: >> >>> You shouldn't return anything in the callback function. you need to >>> remove "return $source" line from there. >>> Just for test purposes put this line in callback function and see if yo= u >>> can get any form error form_set_error('iller_select', 'Error.'); >>> >>> >>> On 4 December 2013 12:59, Muzaffer Tolga Ozses <[email protected]> wrote: >>> >>>> Look at >>>> http://git.webciniz.im/?p=3Dproject/night_pharmacy.git;a=3Dblob;f=3Dni= ght_pharmacy.module;h=3D49adff05adea3549c4566c2cb2ec2ce2f6d5db08;hb=3D16ee6= 0869975ca8794abc193e0713376945c0c02#l54. I made the changes you suggested a= nd no dice :S >>>> >>>> >>>> On 4 December 2013 14:54, Murat G=FCnana <[email protected]> wrote: >>>> >>>>> implement your form submit element like; >>>>> $form['actions']['submit'] =3D array( >>>>> '#type' =3D> 'button', >>>>> '#value' =3D> t('Submit'), >>>>> '#submit' =3D> 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]>wrot= e: >>>>>> >>>>>>> night_pharmacy_table is a form submit callback. It already gets >>>>>>> passed the $form parameter; you have got the function signature wro= ng. >>>>>>> >>>>>>> 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_refere= nce.html/7#submit_property >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 4 December 2013 12:14, Muzaffer Tolga Ozses <[email protected]>wro= te: >>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> This is really a PHP question, but it involves $form_state, so bea= r >>>>>>>> with me please. >>>>>>>> >>>>>>>> In my code at >>>>>>>> http://git.webciniz.im/?p=3Dproject/night_pharmacy.git;a=3Dblob;f= =3Dnight_pharmacy.module;h=3D132b5d4a90692acfadfe9e11af128f712df1c24d;hb=3D= 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] >>>>> >>>> >>>> >>> >>> >>> -- >>> Kind regards, >>> >>> Murat Gunana >>> Tel: 07927964976 >>> Email: [email protected] >>> >> >> > > > -- > Kind regards, > > Murat Gunana > Tel: 07927964976 > Email: [email protected] > --f46d043bdfa20031ae04ecb679c3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:courier = new,monospace">So, what else can I check?</div></div><div class=3D"gmail_ex= tra"><br><br><div class=3D"gmail_quote">On 4 December 2013 15:24, Murat G= =FCnana <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">According to the form api i= t should be able to do that.<br></div><div class=3D"HOEnZb"><div class=3D"h= 5"><div class=3D"gmail_extra"> <br><br><div class=3D"gmail_quote">On 4 December 2013 13:17, John Morahan <= span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_b= lank">[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">'#type' =3D> = 9;button' won't execute a submit callback, try '#type' =3D&= gt; 'submit'</div> <div><div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On = 4 December 2013 13:16, Murat G=FCnana <span dir=3D"ltr"><<a href=3D"mail= to:[email protected]" target=3D"_blank">[email protected]</a>></span> wr= ote:<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>You shouldn't retu= rn anything in the callback function. you need to remove "return $sour= ce" line from there.<br> </div>Just for test purposes put this line in callback function and see if = you can get any form error <span style=3D"margin:0px;padding:0px;border:0px= none;font-family:'Bitstream Vera Sans Mono',Monaco,'Lucida Con= sole',monospace;font-style:normal;font-variant:normal;font-weight:norma= l;line-height:17.9844px;font-size:12px;vertical-align:baseline;letter-spaci= ng:normal;text-align:start;text-indent:0px;text-transform:none;white-space:= pre-wrap;word-spacing:0px;background-color:rgb(246,246,242);color:rgb(0,0,1= 87)">form_set_error</span><span style=3D"margin:0px;padding:0px;border:0px = none;font-family:'Bitstream Vera Sans Mono',Monaco,'Lucida Cons= ole',monospace;font-style:normal;font-variant:normal;font-weight:normal= ;line-height:17.9844px;font-size:12px;vertical-align:baseline;letter-spacin= g:normal;text-align:start;text-indent:0px;text-transform:none;white-space:p= re-wrap;word-spacing:0px;background-color:rgb(246,246,242);color:rgb(0,119,= 0)">(</span><span style=3D"margin:0px;padding:0px;border:0px none;font-fami= ly:'Bitstream Vera Sans Mono',Monaco,'Lucida Console',monos= pace;font-style:normal;font-variant:normal;font-weight:normal;line-height:1= 7.9844px;font-size:12px;vertical-align:baseline;letter-spacing:normal;text-= align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-s= pacing:0px;background-color:rgb(246,246,242);color:rgb(221,0,0)">'iller= _select'</span><span style=3D"margin:0px;padding:0px;border:0px none;fo= nt-family:'Bitstream Vera Sans Mono',Monaco,'Lucida Console'= ;,monospace;font-style:normal;font-variant:normal;font-weight:normal;line-h= eight:17.9844px;font-size:12px;vertical-align:baseline;letter-spacing:norma= l;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap= ;word-spacing:0px;background-color:rgb(246,246,242);color:rgb(0,119,0)">, <= /span><span style=3D"margin:0px;padding:0px;border:0px none;font-family:= 9;Bitstream Vera Sans Mono',Monaco,'Lucida Console',monospace;f= ont-style:normal;font-variant:normal;font-weight:normal;line-height:17.9844= px;font-size:12px;vertical-align:baseline;letter-spacing:normal;text-align:= start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing= :0px;background-color:rgb(246,246,242);color:rgb(221,0,0)">'Error.'= </span><span style=3D"margin:0px;padding:0px;border:0px none;font-family:&#= 39;Bitstream Vera Sans Mono',Monaco,'Lucida Console',monospace;= font-style:normal;font-variant:normal;font-weight:normal;line-height:17.984= 4px;font-size:12px;vertical-align:baseline;letter-spacing:normal;text-align= :start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacin= g:0px;background-color:rgb(246,246,242);color:rgb(0,119,0)">);</span></div> <div><div> <div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On 4 December= 2013 12:59, Muzaffer Tolga Ozses <span dir=3D"ltr"><<a href=3D"mailto:t= [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"><font face=3D"courier new, mo= nospace">Look at <a href=3D"http://git.webciniz.im/?p=3Dproject/night_pharm= acy.git;a=3Dblob;f=3Dnight_pharmacy.module;h=3D49adff05adea3549c4566c2cb2ec= 2ce2f6d5db08;hb=3D16ee60869975ca8794abc193e0713376945c0c02#l54" target=3D"_= blank">http://git.webciniz.im/?p=3Dproject/night_pharmacy.git;a=3Dblob;f=3D= night_pharmacy.module;h=3D49adff05adea3549c4566c2cb2ec2ce2f6d5db08;hb=3D16e= e60869975ca8794abc193e0713376945c0c02#l54</a> . I made the changes you sugg= ested and no dice :S</font><br> </div></div><div><div><div class=3D"gmail_extra"><br><br><div class=3D"gmai= l_quote">On 4 December 2013 14:54, Murat G=FCnana <span dir=3D"ltr"><<a = href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&g= t;</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>implement your form su= bmit element like;<br>$form['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_pharmacy_table'),<br> =A0=A0 );<br></div>and make sure you clear the cache.<br></div><div class= =3D"gmail_extra"><div><div><br><br><div class=3D"gmail_quote">On 4 December= 2013 12:49, Muzaffer Tolga Ozses <span dir=3D"ltr"><<a href=3D"mailto:t= [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">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><div class=3D"gmail_extra= "><br><br><div class=3D"gmail_quote">On 4 December 2013 14:35, Patrick Dawk= ins <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">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></div></div><div>-- <br>Kind r= egards,<br><br>Murat Gunana<br>Tel: 07927964976<br>Email: <a href=3D"mailto= :[email protected]" target=3D"_blank">[email protected]</a><br> </div></div> </blockquote></div><br></div> </div></div></blockquote></div><br><br clear=3D"all"><br>-- <br>Kind regard= s,<br><br>Murat Gunana<br>Tel: 07927964976<br>Email: <a href=3D"mailto:mgun= [email protected]" target=3D"_blank">[email protected]</a><br> </div> </div></div></blockquote></div><br></div> </div></div></blockquote></div><br><br clear=3D"all"><br>-- <br>Kind regard= s,<br><br>Murat Gunana<br>Tel: 07927964976<br>Email: <a href=3D"mailto:mgun= [email protected]" target=3D"_blank">[email protected]</a><br> </div> </div></div></blockquote></div><br></div> --f46d043bdfa20031ae04ecb679c3--