joejac
Posts: 242
|
| Posted: 04/27/2010, 12:08 PM |
|
Hello,
In a multi-step form I have a 2 date fields:
a.- bid_date1 in order to show the current date to the user
b.- bid_date is a hidden field that will store the bid date into MySQL database
When the user go to step 2 of the form and then come back to step 1 or he wants to modify some bid data I have an event that reads the date: "bid_date" from the URL and displays this in bid_date1.
I do this in before show event for bid_date1:
$biddate = CCGetParam("bid_date","");
if(empty($biddate)) { // No date so todays date
$Component->SetValue(strtotime(date("Y/m/d")));
$form->bid_date->SetValue(strtotime(date("Y/m/d")));
}
else { // Date from URL
$Component->SetValue($biddate);
}
The first time of course it displays the date good but when reading date from URL something is wrong because it always shows: "01/01/1970" and should be for today: 27/4/2010 (Spanish date)
In the URL I see:
bid_date=27%2F04%2F2010
1.- How can I do with this line in order to display the date correctly?:
$Component->SetValue($biddate);
2.- How can I disable the form validation error just for this hidden field bid_date?
2.1 This is because no matter what do I enter into DataType and DBFormat in the field Data Properties it is always issuing the error:
"The value in the field bid_date is not valid. use the following format:: dd/mm/yyyy"
And it is funny because that is the format I use. If I change the format the error changes and request I use the format that the field is using anyway, very strange to me.
I have not found much information on the web. So any help it is very much appreciated.
Best regards
joejac
|
 |
 |
Waspman
Posts: 948
|
| Posted: 04/28/2010, 4:44 AM |
|
does the user have to go back to the same page? it can look the same but....plus if you created some kind of ID and saved it as a session it can be called.?
Just a thought
_________________
http://www.waspmedia.co.uk |
 |
 |
joejac
Posts: 242
|
| Posted: 04/28/2010, 8:15 AM |
|
Hello Waspman, and thanks for your answer.
The multi-step form works in 2 ways:
1.- Normal user: no login required, it goes back and forth with no problem through all the pages. The bid_date written in the URL via page1.php is in this format: 27%2F04%2F2010
2.- Distributor user: who logs in with ID and password, and prior the multi-step page1.php there is a grid page with the list of all bids for that Distributor plus the bids that do not have any distributor assigned.
2.1 When I click on the bid_id it sends all the parameters for that bid_id to page1.php, and here is the problem, I have noticed that the bid_date passed in the URL is 2010-04-27 while the bid_date written in the URL via page1.php is in this format: 27%2F04%2F2010, probably this inconsistency is causing that page1.php issues the error only when the URL comes from the distributor bid list page, not from the multi-steps form itself.
2.2 I do not have a way to control the date format of the parameter passed via the URL. I use the following format: dd/mm/yyyy in The Date Display Format in Project-Settings and in the bid_date control. In the connection for the server data base I use: yyyy-mm-dd HH:nn:ss which is the one I use in MySQL.
3.- Any possible solution is very welcomed, because I am totally stuck in this "simple" issue, while I was able to handle some Ajax Stuff.
Regards
joejac
|
 |
 |
Waspman
Posts: 948
|
| Posted: 04/28/2010, 12:25 PM |
|
I have had similar issues with dates sent as params from a record they are usually YMD so I send the user to a different page that looks the same and I tell the where statement what format to expect. I find that sometime you can't always do it with the same pages so make then ook the same.
I may be off track as I don't really understand your logic 
If the record is already created why are you passing anything other than the Bid id?
_________________
http://www.waspmedia.co.uk |
 |
 |
jjrjr1
Posts: 942
|
| Posted: 04/28/2010, 5:01 PM |
|
Hi
Try:
$Component->SetValue(strtotime($biddate));
Ensure the order of the date fields are correct.
Let me know.
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
portaflex
Posts: 4
|
| Posted: 05/23/2010, 1:34 PM |
|
Thank you for the hint.
This is what worked for me on the beforeshow retrieve value for control function:
$Container->cita_fecha->SetValue (strtotime(CCGetFromGet("s_fecha", "")));
|
 |
 |
|