It's taken me quite a while to get my head round Chronoforms v7 compared to v5.
I have a basic form which submits a start date, end date and number of adults to a hotel's third party booking system. The data is redirected and the date formatting works.
However, there are two extra elements needed which I did manage to setup in v5 which I can't seem to setup in v7.
[strong]<?php
$form->data['arrival'] = date('Y-m-d');[br] $form->data['departure'] = date('Y-m-d', strtotime ('+2 days'));[br]?>[/strong]
and in the HTML (render form) block "on submit" I added the following "form tag attachment" to open the results in a new window:
onSubmit="return validate();" target="_blank"
[br]Can anybody assist me with this please? I've spent quite a while trying to find a solution to these last two items.
Many thanks,
Mike
I have a basic form which submits a start date, end date and number of adults to a hotel's third party booking system. The data is redirected and the date formatting works.
However, there are two extra elements needed which I did manage to setup in v5 which I can't seem to setup in v7.
- I need to set the arrival date to "today's date"
- I need the redirection results to open in a new window
[strong]<?php
$form->data['arrival'] = date('Y-m-d');[br] $form->data['departure'] = date('Y-m-d', strtotime ('+2 days'));[br]?>[/strong]
and in the HTML (render form) block "on submit" I added the following "form tag attachment" to open the results in a new window:
onSubmit="return validate();" target="_blank"
[br]Can anybody assist me with this please? I've spent quite a while trying to find a solution to these last two items.
Many thanks,
Mike
You can use CF7-shortcodes to preset a formfield. There are a lot of these shortcodes,
look here https://www.chronoengine.com/forums/posts/t110058/shortcodes-cheatsheet.
Open the fields "Advances Settings" -> enable "Value & Placeholder" and put into the "Value"-Field one of these:
$now = date("m-d-y");
$this->data("arival",$now,true);
cheers Eddi
look here https://www.chronoengine.com/forums/posts/t110058/shortcodes-cheatsheet.
Open the fields "Advances Settings" -> enable "Value & Placeholder" and put into the "Value"-Field one of these:
- Get the current UTC date in Y-m-d H:i:s format: {date:}
- Pass a desired date/time format using the PHP format strings: {date:H:i}
- Pass a date value to be formatted: {date:Y-m-d$(var:some_date_value_or_timestamp)}
- Set the timezone to the one used by your site {date/site:}
- Set a timezone {date/region/time_zone:format_string}
- Set a future date/time {date:format_string $+ xx days yy hours}
$now = date("m-d-y");
$this->data("arival",$now,true);
cheers Eddi
thank you Eddi. I was missing that cheatsheet. i now have the date search form setup with today’s date.
the only bit i’m missing now is opening the redirection results in a new window.
i can hack it in as an attribute in the admin form output file but I was to be able to do it within the component.
overall I’m happy but redirection in a new window would be the cherry on the cake.
cheers mke
the only bit i’m missing now is opening the redirection results in a new window.
i can hack it in as an attribute in the admin form output file but I was to be able to do it within the component.
overall I’m happy but redirection in a new window would be the cherry on the cake.
cheers mke
You need to login to be able to post a reply.