I have infobox templte like:
{{Infobox
|image = {{{image|}}}
}}
and i want that template show image even if user type blablabla instead of image.what should i do ?
You can have “aliases“ for parameter names like this: {{{image|{{{picture|{{{file|}}}}}}}}}. This will work for image = ..., picture = ..., and file = ....
It's not possible to get the value of any parameter name, though.
If the user mistypes the parameter name, you cannot catch that [in the template alone][with standard template functions].
If you want the user to freely choose a parameter name, you can do that but he needs to tell you the parameter name. Example:
The {{{1}}} is {{{{{{1}}}}}}.
{{MyTemplate|parameter|parameter=variably named}}
->
The parameter is variably named.
Related
At work, one of the systems I use outputs voyage schedules. The URL for each voyage is constructed as the form address followed by ?voyageCode= followed by the voyage number, which is a two-letter route prefix and a three-digit voyage number.
Rather than use the standard form, which has a whole bunch of fields I never need to use, I want to build a simple page where I can just select the route and enter a voyage number.
In practical terms, I'm trying to build a form with the following:
A drop-down menu or set of radio buttons to select the two-letter route code;
A text field to enter the three-digit route code;
A button or link to combine those inputs into a link in the format [LINK]?voyageCode=[ROUTE CODE][VOYAGE NUMBER]
My HTML knowledge is pretty outdated, and I've never worked much with forms. Can anyone advise on how I can construct this?
Why don't you use a select tag for the dropdown and a classic input text for the route coude ?
Then for the link part, you should capture the click event on your button through onClick and then call a small function that'll basically do that :
function concatRouteCode(){
var select= document.getElementById("routeCodeLetters");
var routeCodeLetters = select.options[select.selectedIndex].value;
var routeCodeNumber = document.getElementById('routeCode').value;
return routeCodeLettres+routeCodeNumber;
}
If you really want to combine the codes into a single query parameter, you'll have to use Javascript to fetch the values of the two fields and change the location. You don't need Javascript if you put the values into separate parameters, as in ?routeCode=xx&voyageNumber=123. In that case you would just give the select element the attribute name=routeCode and the input field the attribute name=voyageNumber.
In case you want to go with the first approach, you'd have something like
document.getElementById("idOfSubmitButton").addEventListener("load", function() {
const routeCode = document.getElementById("idOfSelectElement").value;
const voyageNumber = document.getElementById("idOfInputField").value;
location.href = "base URL here" + "?voyageCode=" + routeCode + voyageNumber;
});
I would like to create a contenttype that has select fields for things like 'month of year' and 'type of product' and have the title field be auto generated based on the values of these two fields.
This is because the two select field values are descriptive enough, and I would like to reduce the amount of repetitive typing of the same information the end user of the CMS may have to do to make a title show up in the admin interface instead of (no content …) or (no title …) due to no title or excerpt.
I have tried using a hidden field for the title with a default option and a uses option like for slug but couldn't make it work.
Is there a way to achieve a dynamically generated title based on other field values?
Solved using the title_format option like title_format: [month, type] in the contenttype definition.
What I am trying to do is use the radio button value chosen by the user to update the variable in the controller. That variable depending on the value will do an http call for the specific answer.
Example:
Chose cars -> variable temp = cards -> http calls cars method
Chose house -> variable temp = house -> http calls house method
In the view I have something like this:
<input id ="inputOne" type="radio" ng-value="cars" ng-model="controller.selection">
<input id ="inputTwo" type="radio" ng-value="house" ng-model="controller.selection">
<input id="mySubmit" type="button" ng-click="controller.selectionChosen">
In my Controller I have something like this:
var vm=this;
vm.selection;
function selectionChosen(){
alert(vm.selection);
// If selection == cars do this
// If selection == house do this
}
You might wonder why it is 'controllerName.variableName', I am following best practices (found here) `so the way it is set up requires controller name then the variable.
My problem I am having is for some reason the value is not binding. When the alert happens it alerts 'undefined' and I am not sure why. I have looked at many tutorials and examples online and this looks like it should work.
Update
So I am pretty sure it is binding or at least trying to. When I set the variable initialized to "test" the first alert shows "test". After clicking a button then it goes to 'undefined".
The problem is coming from the ng-value="cars"
since you are using Mycontroler as controller it should be ng-value='controller.cars' if you declare cars in your controller
If you just want to use cars as a string in ng-value without declare it, you need to add ' ', angular will undestand it like a string instead of a variable
ng-value="'cars'"
My table contain three fields.
id , name, status
When,I do this {{ form|bootstrap }}, it shows all field.
name is drop-down in html.
I want to display only those entry whose status = 1.?
Please add filter in form class init method,
so that you will only get status=1 in html.
Or you can try ajax.
in the table I have a field true or false and I would like to display an image if it is true and another if it's false.
What would be the expression
View my table:
Assuming that you want to display the image in a textbox, and assuming that you are using images that you have embedded in the report (i.e. you have inserted images into the report and are not using an external reference or a database image) called image1 and image2, and assuming that the name of the field with the True/False value is Mailing, select the text box to hold the image and then find the BackgroundImage property in the Properties window. Expand it - set source to Embedded and set Value to the following expression:
=iif(Fields!Mailing.Value = "True", image1, image2)
If your field value is a bit data type, your expression looks like this:
=iif(Fields!Mailing.Value = 1, image1, image2)