Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 29. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Trigger AFTER or php?

phpMyEdit Configuration     Trigger AFTER or php?
Odoslať novú tému   Odpovedať na tému    
 
twhit67     Založený: 03.02.2010   Príspevky: 16  
Príspevok Zaslal: 2010-04-07 13:38
Návrat hore  Odpovedať s citátom     

Folks,
Trying to get a cleartext to post to a hidden field from input to my calendar field;

calendar input field name=DATE
hidden field = MONTH

Need to pull the month portion of date (example 03/21/10) and post the cleartext (example March) to my hidden month field -

Tried php:
Kód:
if($d = '02/%');
echo date('F', mktime(0,0,0, preg_replace("/[^\d]/", '', $d)));//Output: February


..with no luck. Was wondering if a Trigger After would be better suited here. Any experts care to share your thoughts?
Thanks.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-04-07 16:28
Návrat hore  Odpovedať s citátom     

Try this:

Kód:
if(isset($_POST['PME_sys_saveadd']) && $_POST['PME_sys_saveadd'] == 'Save'){

  $opts['cgi']['overwrite']['your_field'] = date('F');

}


 
twhit67     Založený: 03.02.2010   Príspevky: 16  
Príspevok Zaslal: 2010-04-07 18:20
Návrat hore  Odpovedať s citátom     

Inputting your suggested code as such;
Kód:
$opts['fdd']['MONTH'] = array(
  'name'     => 'MONTH',
  'select'   => 'T',
  'options'  => 'AVLCD',
  'input'    =>  'H',
);

if(isset($_POST['PME_sys_saveadd']) && $_POST['PME_sys_saveadd'] == 'Save'){

$opts['cgi']['overwrite']['DATE'] = date('F');
}


..is not updating my MONTH field. Have I got your code placed incorrectly? I haven't yet familiarized myself with the cgi options - am reading on that now.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-04-07 20:25
Návrat hore  Odpovedať s citátom     

Guess what ... there are reserved words in MySQL and PHP. You can't use reserved words as a field name. Date and month are probably reserved words. You may have other problems but you want to first make sure the query is not failing because you're using reserved words as the name of a field.

 
twhit67     Založený: 03.02.2010   Príspevky: 16  
Príspevok Zaslal: 2010-04-07 20:38
Návrat hore  Odpovedať s citátom     

shoot! Quite right; DATE is a definate - I'll have to look at MONTH. I'll adjust and retry your solution.

Thanks again Doug.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-04-07 20:44
Návrat hore  Odpovedať s citátom     

You might also want to get in the habit of using lower case naming conventions due to portability issues.

 
twhit67     Založený: 03.02.2010   Príspevky: 16  
Príspevok Zaslal: 2010-04-07 21:13
Návrat hore  Odpovedať s citátom     

Yes I could shoot myself on the caps - but was more than half way through and will have to adjust that eventually;

But back to my original problem:
My input of your solution is still not yielding any results; any more suggestions in that regard?

Sorry to be a pain.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-04-07 21:20
Návrat hore  Odpovedať s citátom     

You're on the right track. But if the input is Hidden then it's ignored.

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-04-07 21:27
Návrat hore  Odpovedať s citátom     

Maybe something like

Kód:
if(isset($_POST['PME_sys_saveadd']) && $_POST['PME_sys_saveadd'] == 'Save'){

   $opts['fdd']['MONTH'] = array(
     'name'     => 'MONTH',
     'select'   => 'T',
     'options'  => 'AVLCD'
   );

   $opts['cgi']['overwrite']['DATE'] = date('F');

}else{

   $opts['fdd']['MONTH'] = array(
     'name'     => 'MONTH',
     'select'   => 'T',
     'options'  => 'AVLCD',
     'input'    =>  'H',
   );

}


 
twhit67     Založený: 03.02.2010   Príspevky: 16  
Príspevok Zaslal: 2010-04-08 14:21
Návrat hore  Odpovedať s citátom     

Doug,
Thanks for taking the time to address my problem; I still haven't got it to work and am trying to analyze the problem:

Could this be a problem related to the Calendar javascript? I'm certain there's nothing wrong with the fix you provided and since I'm only pulling data from the calendar input field I can only assume this might require some java-based solution;

I've got your original code input to form:
Kód:
$opts['fdd']['MONTH'] = array(
  'name'     => 'MONTH',
  'select'   => 'T',
  'options'  => 'AVLCD'
);
if(isset($_POST['PME_sys_saveadd']) && $_POST['PME_sys_saveadd'] == 'Save'){

$opts['cgi']['overwrite']['DATE'] = date('F');
}


 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2010-04-08 14:48
Návrat hore  Odpovedať s citátom     

Short on time today ... perhaps a trigger after which queries the value of the date field, strips out the first 2 digits, and then updates the month field would be easier for you to achieve (limited to Add mode).

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov