Datalist behavior changed - css

We had a datalist in our website which worked ok.
But recently (without any knowledgable code changes) it started messing up in Firefox/IE/Edge, but still works perfect in Chrome. Before it worked in every browser as it works in Chrome.
The code for the datalist looks like this:
<div class="form-group">
<!--<input type="text" class="form-control" placeholder="<?=lang("home_filter_where")?>" />-->
<div class="input-group">
<?php
if (!empty($filterdata['location'])) {
?>
<input id="location" name="location" type="text" list="locationList" autocomplete="off" value="<?php echo $filterdata['location']; ?>" class="form-control round-r">
<?php
} else {
?>
<input id="location" name="location" type="text" list="locationList" autocomplete="off" placeholder="Postcode of Gemeente" class="form-control round-r">
<?php
}
?>
<div class="aListCon">
<datalist id="locationList">
<!--[if IE 9]><select disabled><![endif]-->
<?php
foreach ($citiesbe as $city) {
echo "<option value=\"$city->zip_code\">$city->name_nl";
}
?>
<!--[if IE 9]></select><![endif]-->
</datalist>
</div>
</div>
</div>
it can be seen from the following URL:
https://www.giveaday.be/.
It is the search form on the homepage (we have this same field on a lot of pages, but the behavior is the same everywhere).
If I open it in Chrome, it looks like this:
https://imgur.com/a/DBInl , but in Edge it looks like this: https://imgur.com/a/1WQUj , and on IE like this: https://imgur.com/a/9lhsx.
Please note that the screenshots is only when i type in the value of the datalist!
In Chrome (as expected) when I type in letters (so the text in the option), the results also show up, this is not happening in firefox/IE/Edge, only typing the value works there.
What has happened and how do I make the datalist work again as it worked before on chrome/ie/edge/firefox ?

Related

action in wordpress to template page

In my plugin I have an action in my form that is supposed to take me to a template page called go, but when I click on it wordpress tells me that it does not exist but if I refresh the page then it loads up the go page. Any ideas why it wont just load normally and how to fix it?
<form name="trailer-bulk-waste-free" method="post" action="go">
<input type="hidden" name="date" value="<?php echo"$date"; ?>">
<input type="hidden" name="pickup" value="<?php echo"$pu" ?>">
There is a bunch of other inputs in here but probably redundant to put.
<p><input type="submit" name="CONTINUE" value="CONTINUE" />
An easy and straight forward way is to assign the go page template to a page. Let's say ID of that page is 77, then do this.
<form name="trailer-bulk-waste-free" method="post" action="<?php the_permalink( 77 ); ?>">
<input type="hidden" name="date" value="<?php echo"$date"; ?>">
<input type="hidden" name="pickup" value="<?php echo"$pu" ?>">
There is a bunch of other inputs in here but probably redundant to put.
<p><input type="submit" name="CONTINUE" value="CONTINUE" /></p>
</form>
Hopefully, this will work as you expect it to.
Try it with another browser to see if it might be from the browser's cache.

Input box in Widget not working WordPress

I am working on a plugin for countdown timer for WordPress. Found a tutorial here
have implemented everything stepwise. but the input box in the Timer Widget does not allow to input date, hours, time. So basically, this is not working.
<a class="tp-time-edit" href="javascript:void(0);">[ Edit ]</a><br/><br/>
<label>Select a date:</label><br/>
<input type="text" name="tp-date" class="tp-date" readonly="true" value="<?php echo $tp_arr['tp-date']; ?>"></input>
<p><div class="tp-time"><label>Hours</label>
<input name="tp-hour-val" class="tp-hour-val" value="<?php echo $tp_arr['tp-hour']; ?>" readonly="true"></input><div class="tp-hour"></div>
</p>
<p><label>Minutes</label>
<input name="tp-minute-val" class="tp-minute-val" readonly="true" value="<?php echo $tp_arr['tp-minute']; ?>"></input><div class="tp-minute"></div></div></p>
<input type="hidden" name="tp-hidd" value="true" />
<input type="button" class="tp-insert-shortcode button-primary" id="publish" value="Insert Short-Code" />
this is the code which displays the input boxes in the text widget. M not able to figure out whts wrong with this.
As i check the tutorial link . there is nothing wrong with the sample code that u provide
you have to check first do you really get the value of those PHP variables
i.e
<?php echo $tp_arr['tp-date']; ?>
<?php echo $tp_arr['tp-hour']; ?>
<?php echo $tp_arr['tp-minute']; ?>
First of all check those variables ???

jquerymobile controlgroup not displaying properly

I'm updating website and gradually changing all bits over to jquerymobile to make it more phone friendly.
I had a page where a user can select either a specific month or a date range. I toggled between them using some javascript. However, since changing things the display:block etc doesn't seem to work properly. It displays them out of position. The input fields are now displayed above the selector when you toggle between them. Please see http://jsfiddle.net/pfLme/1/
Obviously I would like to get them into the correct position.
(The next task will be to try and get Datepicker working - if anyone fancies pointing me in the right direction for that)
Thank you.
(code is all on jsfiddle, but stackoverflow tells me i need to include it here too)
function showType(allornone) {
if (allornone == '1month')
{
document.getElementById('btwdateselector').style.display = 'none';
document.getElementById('monthselector').style.display = 'block';
document.getElementById('datestart').value = '';
document.getElementById('dateend').value = '';
}
if (allornone == '2dates')
{
document.getElementById('btwdateselector').style.display = 'block';
document.getElementById('monthselector').style.display = 'none';
}
} //end function
...I realise now of course that I have to get used to thinking about & taking advantage of the jquery side of jquery mobile too.
So far I came up with
$(document).on('click', '#certainmonth', function(a) {
$('#monthselector').hide();});
$(document).on('click', '#btwdates', function(a) {
$('#btwdateselector').show();});
I'm not sure yet how to include the if statement and toggle between the show and hide.
The error was only occurring in Firefox 27.0.1
Solution was to change <fieldset data-type="controlgroup"> to <div data-type="controlgroup"> around the radioboxes. Thanks to Omar for the help.
http://jsfiddle.net/pfLme/11/
<form action="page.php" name="mileageform" class="responsive_block" data-ajax="false">
<div data-role="controlgroup">
<legend>Should be at TOP</legend>
<input type="radio" name="searchtype" value="certainmonth" id="certainmonth" checked="checked" />
<label for="certainmonth">Mileage for certain month</label>
<input type="radio" name="searchtype" value="btwdates" id="btwdates" />
<label for="btwdates">Mileage between two dates</label>
</div>
<fieldset id="monthselector" data-role="controlgroup" data-type="horizontal">
<select name="month" data-native-menu="false">
<option value="1">1</option>
<option value="2">2</option>
</select>
<select name="year" data-native-menu="false">
<option value="2000">2000</option>
<option value="2001">2001</option>
</select>
</fieldset>
<fieldset id="btwdateselector" class="ui-screen-hidden">
<div class="ui-field-contain">
<label for="datestart">Start Date:</label>
<input type="date" id="datestart" name="datestart" placeholder="dd/mm/yyyy" />
</div>
<div class="ui-field-contain">
<label for="dateend">End Date:</label>
<input type="date" id="dateend" name="dateend" placeholder="dd/mm/yyyy" />
</div>
</fieldset>
<input type="submit" onclick="return checkForm();" value="Display Mileage" />
</form>
$(document).on('change', '#certainmonth, #btwdates', function (a) {
$('#monthselector').toggleClass("ui-screen-hidden");
$('#btwdateselector').toggleClass("ui-screen-hidden");
});

Saving radio button options to access them later in wordpress plugin

This is my code for the radio buttons. I would like them to be displayed in the settings page and save it for future use.
<form method="post" action="options.php">
<?php
wp_nonce_field('update-options');
$rsp_position = get_option('rsp_position');
if(empty($rsp_position)){
$rsp_position = "true";
} else {
$rsp_position = get_option('rsp_position');
}
?>
<p><strong>Ad Placing:</strong><br />
<input type="radio" id="1" name="rsp_position" <?php if($rsp_position == 'true') echo 'checked="checked"'; ?> value="true" />yes <br />
<input type="radio" id="2" name="rsp_position" <?php if($rsp_position == 'false') echo 'checked="checked"'; ?> value="flase" />no <br />
<input type="text" name="publisher-id" size="45" value="<?php echo get_option('publisher-id'); ?>" />
</p>
<p><input type="submit" name="Submit" value="Save" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="publisher-id" />
<?php
settings_fields( 'save_position' );
register_setting( 'save_position', 'rsp_position');
?>
You're going along the right lines, but your calls to settings_fields and register_setting aren't in the right place.
Read Otto's tutorial on this, it's a good introduction to the settings API.
Basically, add an admin_init action and in the callback register the setting and use add_settings_field to create the form items.
Then in your add_options_page callback you make the call to settings_fields to display the entries created with add_settings_field.
If you're still struggling having worked through Otto's tutorial, post back again.
EDIT: Following pastebin entry.
The failure to save is a result of your validation function not returning the expected value. The preg_match is not finding the right value and turning the string to '' (nothing) before saving - so it looks like it's not saving, when in fact it's saving nothing.
You could also check out the following functions which may be useful.
submit_button
settings_errors

Wordpress adding custom field update fails

i am picking up wordpress development and reading the book digging into wordpress. i have the code below in functions.php
<?php
add_action('admin_menu', 'addAmazonAffiliateOptions');
function addAmazonAffiliateOptions() {
add_options_page('Global Custom Fields', 'Global Custom Fields', 8, 'functions', 'editGlobalCustomFields');
}
function editGlobalCustomFields() { ?>
<div class="wrap">
<h2>Global Custom Fields</h2>
<form action="options.php" method="post">
<?php wp_nonce_field('update_options'); ?>
<p>
<label for="amazonId"><strong>Amazon ID</strong></label>
<input type="text" name="amazonId" value="<?php echo get_option('amazonId'); ?>" />
</p>
<p>
<input type="submit" name="submit" value="Update Options" />
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="amazonId" />
</p>
</form>
</div>
<?php }
when i try to save the options, i get
Your attempt to edit your settings has
failed.
how do i debug such things in wordpress?
I think you need to be using register_setting() - the WordPress core and API has changed quite considerably since that book was published.
Check out the codex on WordPress 2.7+ for adding plugin options pages.

Resources