We are using a View to insert a 'first step' Check Availability form, which then continues on to a programmed url (with the variables in the url).
But we would like to change the 'nights' drop down to default to 2 nights ... currently set to 1.
I've changed the default in the field's settings (screenshot 1) - but it's not changed anything (screenshot 2).
Please can I check if this is possible to do from the 'wpv-control-postmeta' shortcode instead? I've tried adding default="2" but it didn't seem to work.
Here is the code so far (screenshot 3) and below:
<span>Nights</span> [wpv-control-postmeta field="wpcf-nights" type="select" url_param="nights"]
Thanks
Nick
Hi Nick,
The [wpv-control-postmeta] shortcode does not have a defulat value.
Please use the shortcode below to add a default value for the Form field:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
For more information:
https://toolset.com/forums/topic/pass-atribbute-arguments-to-a-cred-edit-form/
Thanks.
Hi,
I'm not actually using a Cred form. I'm using the filter setting on a view as a workaround to grab the selection and then forward onto the actual booking site which picks up the variables via the url.
In case it helps and you spot a solution, here is my complete code for the filter:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="wpb_column column_container col-sm-4" align="center" style="margin-left:-10px">
<span class="check-availability-label">Arrive</span><br> [wpv-control-postmeta field="wpcf-arrival" type="date" url_param="arrive-date-picker"]
</div>
<div class="wpb_column column_container col-sm-4" align="center" style="margin-left:-15px">
<span class="check-availability-label">Nights</span> [wpv-control-postmeta field="wpcf-nights" type="select" url_param="nights"]
</div>
<div class="wpb_column column_container col-sm-4">
<div style="padding-top:15px;">
[wpv-filter-submit name="Check Availability" type="button" output="bootstrap"]
</div>
<input type="hidden" name="arrive" value="">
<input type="hidden" name="Chain" value="8565">
<input type="hidden" name="template" value="Responsive_GIHL">
<input type="hidden" name="shell" value="RBE_GIHL2">
<input type="hidden" name="hotel" value="22921">
<input type="hidden" name="adult" value="2">
[/wpv-filter-controls]
[wpv-filter-end]
Is there a way to set the default value, other than removing it from the Nights dropdown as an option
Hi there,
Unfortunately, the "wpv-control-postmeta" shortcode does not have any default value selection functionality. It might be possible with Javascript.
Would you please provide the link tot the page that contains the "Nights" dropdown and tell me which option should be selected?
It might be possible.
Also, you can provide login information by setting the next reply as private if there is a need for login to access that page.
Hi Nick,
I went to the View that contained the dropdown and under the JS Editor added the code below:
$('#wpv_control_select_wpcf-nights').val('2');
It selects the SELECT html tag with the ID of "wpv_control_select_wpcf-nights" and selects the second option.
Please consider that it will take a few seconds for the Javascript code to render and it is a normal behavior.
Thanks.
Fantastic .. works great.
Thank you so much for having a look and suggesting JS code!!