Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Sunday, October 18, 2026
About Us
O nás
Magazine
Magazín
Open Source
Otvorený softvér
CVS
CVS
Services
Služby
Index  »  Projects  »  phpMyEdit  »  Forum  »  Help! Save/Apply operation passed parameter rules set.

phpMyEdit General     Help! Save/Apply operation passed parameter rules set.
Post new topic   Reply to topic    
 
So     Joined: 11 Jan 2011   Posts: 2  
Post Posted: 2011-01-11 04:39
Back to top  Reply with quote     

Hi friends! phpMyEdit is great!

I set a rule that the field (DATE) is 'required' and it works fine. User will be prompted to enter the required value when they hit save or apply buttons.

However, in this case I want to avoid user from entering the 1st day of each month so I wrote;
Code:
$opts['fdd']['date'] = array(
  'name' => 'Date',
  'sqlw' => 'IF($val_qas LIKE "%%%%-%%-01", NULL, $val_qas)',
  'select' => 'T',
  'maxlen' => 10,
  'sort' => true,
  'calendar' => true,
'required' => true
);

If you noted - the 'sqlw' says that if the date is the 1st the month, it will return to NULL and that is also working fine where phpMyEdit will post a NULL value to the field when users click Apply and force them to enter the date when they try to save the form.

However the problem is that if the user hit the Save button without hitting the Apply first! phpMyEdit with post the NULL value into the database without prompting or forcing the user to enter the date. I'd like to prevent this from happening.

Please can you or anyone help me to solve this or tell me if there is another or easier way to do it?

Thank you guys :-)

 
So     Joined: 11 Jan 2011   Posts: 2  
Post Posted: 2011-01-11 05:25
Back to top  Reply with quote     

Hi guys!

Life is strange and interesting. I try to think the logic of this simple problem for hours but can not solve it and when I posted here, after a few minutes the idea just come to my head from the sky!

I added ADDDATE() function the the code and it works just like magic! Here is the new code;

Code:
$opts['fdd']['date'] = array(
  'name' => 'Date',
  'sqlw' => 'IF($val_qas LIKE "%%%%-%%-01", ADDDATE($val_qas, INTERVAL 1 DAY), $val_qas)',
  'select' => 'T',
  'maxlen' => 10,
  'sort' => true,
  'calendar' => true,
'required' => true
);


Notice that when I added a day, it solved many problems as well like user don't have to be prompted to change the date, less code, forced by default and many more! The moral, next time when we got problems just go here and ask! If didn't find the solution post it here and God will settle it for us ;-) or someone will help us.

However I still want get suggestions if there are any better ideas to get this code even better!

Thank you.

So wrote:
Hi friends! phpMyEdit is great!

I set a rule that the field (DATE) is 'required' and it works fine. User will be prompted to enter the required value when they hit save or apply buttons.

However, in this case I want to avoid user from entering the 1st day of each month so I wrote;
Code:
$opts['fdd']['date'] = array(
  'name' => 'Date',
  'sqlw' => 'IF($val_qas LIKE "%%%%-%%-01", NULL, $val_qas)',
  'select' => 'T',
  'maxlen' => 10,
  'sort' => true,
  'calendar' => true,
'required' => true
);

If you noted - the 'sqlw' says that if the date is the 1st the month, it will return to NULL and that is also working fine where phpMyEdit will post a NULL value to the field when users click Apply and force them to enter the date when they try to save the form.

However the problem is that if the user hit the Save button without hitting the Apply first! phpMyEdit with post the NULL value into the database without prompting or forcing the user to enter the date. I'd like to prevent this from happening.

Please can you or anyone help me to solve this or tell me if there is another or easier way to do it?

Thank you guys :-)


 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Odkazový formulár · Application form · Prihláška
Report bug on PLATON.SK website · Upozorniť na chybu na PLATON.SK webstránke · Terms of use · Podmienky použitia · Privacy policy · Ochrana osobných údajov