-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No value provided for variable {s} #1871
Comments
What form, submitted where? Closed as incomprehensible. Please try reading bug reporting guidelines before submitting. |
There is a page with a form. In this form the output card. I deduce map: |
I don't understand what's going on. Could you please set up a JSFiddle test case that reproduces the problem? |
I have the same problem when try use map.setView or map.panTo. :( |
@ekaitzht please read how to submit a proper bug report here: https://github.com/Leaflet/Leaflet/blob/master/CONTRIBUTING.md#reporting-bugs |
Not sure if anyone else has had this issue when upgrading, but I hit it. It appears that there is no longer any default zoom factor, so if you try calling setView without setting any zoom factor, then bang! it falls. The error message is a complete red herring. Anyhow, if you just set any zoom factor then this should fix that issue. There might, of course, be other causes of this, but anyone upgrading from a version with a working default zoom factor may well hit this one, and it is anything but obvious as to what is going wrong. So if this helps someone, then great. Cheers |
@TheIrishman not sure I understand, could you set up a minimal JSFiddle that reproduces the issue? |
Hi mourner, It is not that easy to produce a test case, and I don't use JSfiddle, but, when onLocationFound is triggered if there has been no call made to setZoom then when a call is made to setView leaflet.js will fail with the given error. When walking through the code, I found that _adjustTilePoint failed because the zoom factor was not set. Within this function this line: size = crs.getSize(this._map.getZoom()) returned NaN, as there was no default zoomfactor set. By calling setZoom before calling setView the problem disappeared. In the old version of leaflet.js (from about 2 years ago) this value was defaulted to, I think, 15 (e.g. the whole world). Either way, no exception was raised when calling setView before setting the zoomfactor in the old version of leaflet.js. My old code that threw the exception looked like this: function onLocationFound(e) And the new working code looks like this: function onLocationFound(e) If you would like more details then let me know. Hope that helps to clarify the situation. Cheers Liam Carton PS. I am using leaflet.js to implement the mapping functions inside TribalContact (an encrypted web chat application). And I am deeply appreciative of the work you guys do. I do hope my post is not seen as some kind of criticism. I just want to help others who perhaps get stuck with issues like this. You guys have done a fantastic job with leaflet, and all credit to you for your efforts. Keep up the great work. |
Here's a code snippet that reproduces this bug:
The docs state that Here's what you have to do:
Note the addition of the '11' as a parameter to |
I had the same issue: Error: No value provided for variable {s} It didn't set the Solved it by @jcheek method mentioned above. |
Fixed: https://github.com/Leaflet/Leaflet/pull/2844/files |
issue #1871 fixed, set this._zoom on map init whenever options.zoom is provided
This is not reproducible on current master. |
When submit form not validate this error: No value provided for variable {s} leaflet-src.js:142
code:
template: function (str, data) {
return str.replace(/{ *([\w_]+) *}/g, function (str, key) {
var value = data[key];
if (value === undefined) {
142 line: throw new Error('No value provided for variable ' + str);
Uncaught Error: No value provided for variable {s}
} else if (typeof value === 'function') {
value = value(data);
}
return value;
});
},
The text was updated successfully, but these errors were encountered: