-
Posts
16 -
Joined
-
Last visited
Posts posted by wscwt01
-
-
I have a single Form which allows user to create a new Gift Voucher record.
It is split into 3 input areas Voucher Details, Payment Details and Delivery Details.
I want to add a button on the Payment details section which when activated will copy some of the entered fields from the Payment section to some of the fields in the Delivery section as follows: -
FROM PAYMENT SECTION TO DELIVERY SECTION
PurchaserName DeliveryName
PAddressLine1 DAddressLine1
PAddressLine2 DAddressLine2
PCounty DCounty
PPostCode DPostCode
I am using a Code Building product called PHP Runner which when you add a button gives you a properties widget as per attachment in which to place your bespoke code.
-
This is a php forum
Sorry got you.
Thanks
-
Then you're all set!
Ok does that mean you can provide solution?
-
Normally I would do this with JS but with your current framework not sure if that would work for you.
Hi there,
Thanks for your response.
The Button Properties as per my attachment is looking for JS coding so it may well be it will be fine.
-
Hi again folks,
I have a single Form which allows user to create a new Gift Voucher record.
It is split into 3 input areas Voucher Details, Payment Details and Delivery Details.
I want to add a button on the Payment details section which when activated will copy some of the entered fields from the Payment section to some of the fields in the Delivery section as follows: -
FROM PAYMENT SECTION TO DELIVERY SECTION
PurchaserName DeliveryName
PAddressLine1 DAddressLine1
PAddressLine2 DAddressLine2
PCounty DCounty
PPostCode DPostCode
I am using a Code Building product called PHP Runner which when you add a button gives you a properties widget as per attachment in which to place your bespoke code.
Hope you guys can help,
Al the best,
-
I copied your extra ")"
if ($values['Workings1'] == "F") { $values['ExpiryDate'] = $values['Workings2']; } else if ($values['Workings1'] == "D") { $dateObj = new DateTime($values['IssueDate']); $dateObj->modify("+{$values['Workings3']} days"); $values['ExpiryDate'] = $dateObj->format('Y-m-d'); }
Fantastic............. Thanks a million
-
try
if ($values['Workings1'] == "F") { $values['ExpiryDate'] = $values['Workings2']; } else if ($values['Workings1'] == "D") { $dateObj = new DateTime($values['IssueDate']); $dateObj->modify("+{$values['Workings3']}) days"); $values['ExpiryDate'] = $dateObj->format('Y-m-d'); }
Thanks this is result DateTime::modify(): Failed to parse time string (+730) days) at position 4 ()): Unexpected character
-
In which case it's not an object. Note in the code I provided $values['IssueDate'] is a DateTime() object. Convert $values['IssueDate'] to a DateTime object and try it again.
Hi guys,
I think I am getting confused now as probably so are you, so just to clarify
This bit of the code works absolutely fine: -
{
if ($values['Workings1'] == "F") {$values['ExpiryDate'] = $values['Workings2'];}return true;Where "Workings1" contents is populated depending on what ever Voucher code is selected from a dropdown elsewhere on the Form. It will only ever be "F" or "D"Where "Workings2" contents is populated depending on what ever Voucher code is selected from a dropdown elsewhere on the Form. It will always be a date in shortform.Where "ExpiryDate" is empty field -
What is your code where you create $values['IssueDate'] ?
IssueDate is a Field in the Form which autopopulates with now()
-
It is located in a "Before record Add" event located in an Add New Record page.
I create the code in PHPRunner which is then compiled and uploaded to live server.
The actual code is: -
if ($values['Workings1'] == "F") {$values['ExpiryDate'] = $values['Workings2'];} else if ($values['Workings1'] == "D") {$values['ExpiryDate'] = clone $values['IssueDate'];$values['ExpiryDate']->modify("+{$values['Workings3']}) days");} -
It is located in a "Before record Add" event located in an Add New Record page.
I create the code in PHPRunner which is then compiled and uploaded to live server.What is the code where you (try to) create the object that is being cloned?
-
"clone" doesn't use parentheses. EG
$copy = clone $obj;
Thanks for getting back so quick but unfortunately Fatal error: __clone method called on non-object in /home/z14auch/public_html/vouchers/vouchers/include/tblVouchers_events.php on line 35
-
Admittedly, I get a bit concerned when I see variables named incrementally, but I'm going to assume you're using them as examples. So, to answer the question, you can use a DateTime object.
//stub values for testing purposes $tz = new DateTimeZone('America/New_York'); $values['IssueDate'] = new DateTime('now', $tz); $values['Workings1'] = 'D'; $values['Workings2'] = 'tomorrow'; $values['Workings3'] = '730'; //actual functionality if ($values['Workings1'] == "F") { $values['ExpiryDate'] = new DateTime($values['Workings2'], $tz); } else if ($values['Workings1'] == "D") { $values['ExpiryDate'] = clone($values['IssueDate']); $values['ExpiryDate']->modify("+{$values['Workings3']} days"); } print("<p>This is the expiration date: {$values['ExpiryDate']->format('Y-m-d')}</p>");
This is obviously a less than perfect solution as there's no error checking (what if the 'Workings3' index contained a number of years or seconds? Or 'Bob'?), but it should point you in the right direction. Also, if it's possible for 'Workings1' - and I have to stress again that I really hope that's not what you're calling your indexes - to contain anything other than 'F' or 'D', I'd recommend looking at a switch() statement instead of a spaghetti pile of else if()'s.
Hi maxxd thanks so much for taking the time to look at my problem. I'm afraid that when I ran it it errored. I am using a code building product called PHP Runner and it doesn't seem to recognise the function "clone" which is where it errored.
-
Hi,
I have an application where I have a field containing an Issue Date and a field which contains a Number of Days.
I need to add the Number of Days to the Issue Days to get a Expiry Date.(The bit in bold)
My code as it stands which is not quite working is: -
if ($values['Workings1'] == "F") {$values['ExpiryDate'] = $values['Workings2'];} else if ($values['Workings1'] == "D") {$values['ExpiryDate'] = date('Y-m-d',strtotime($values['IssueDate'])) + (60*60*24*$values['Workings3']));};return true;Any guidance would be much appreciated Working3 is field containing days i.e. 730 (2 years) -
Hi,
I have built an application in PHPRunner. Everything is ok except on my search facility.
Normal Search works fine. However when ever I try to search by a specific column I get the error message: -
ForbiddenYou don't have permission to access /pgcommission/tblworklistV2_list.php on this server.
I have taken advice and read several forums etc and I am told it is due to File Permissions. I have tried every combination I can on both my _List.php and _search.php files for the respective Table but to no avail.
Is there someone out there that can give me a fresh perspective on this and make suggestions?
Many thanks desperate,
Carl.
Help with Error in Database User Interface
in PHP Coding Help
Posted · Edited by wscwt01
Spelling error
I built an application for a client of mine using PHPRunner about 3 years ago. It has functioned perfectly right up to today when they notified me that they were unable to Export any records. I have attached the error report that comes up when you run Export function.
According to the report it is unable to find a file or path. I have been on to server with FTP client and all the paths, files and contents are present.
Can anyone please give me any advise on what might suddenly cause this error after many years. All other functionality of the Database is fine.
Many thanks,
Carl.