We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given an object like:
public class WeatherForecastSearchRequest { [FromQuery(Name = "strings")] public List<string> Strings { get; set; } = new List<string>(); [FromQuery(Name = "since")] public DateTime? Since { get; set; } [FromQuery(Name = "types")] public List<WeatherType> Types { get; set; } = new List<WeatherType>(); [FromQuery(Name = "verbose")] public bool Verbose { get; set; } } public enum WeatherType { Guess, Known }
And a template like:
<div class='search'> <form name='Search' method='get' action> <div class='property'> <label class='name' for='strings'>Strings:</label> <input id='strings' type='text' name='strings' value='{{ Form.Strings | array.join ',' }}' /> </div> <div class='property'> <label class='name' for='since'>Since:</label> <input id='since' type='datetime-local' name='since' value='{{ Form.Since | date.to_string '%Y-%m-%dT%H:%M:%S' }}' /> </div> <div class='property'> <label class='name' for='types'>Types:</label> <select name='types' id='types' multiple> <option value='Guess' {{ selected = ''; if Form.Types | array.contains 'Guess'; selected = 'selected'; end; selected }}>Guess</option> // this line doesn't work as is <option value='Known' {{ selected = ''; if Form.Types | array.contains 'Known'; selected = 'selected'; end; selected }}>Known</option> // this line doesn't work as is </select> </div> <div class='property'> <label class='name' for='verbose'>Verbose:</label> <input id='verbose' type='checkbox' name='verbose' value='true' {{ checked = ''; if Form.Verbose; checked = 'checked'; end; checked }}/> </div> <input type='submit' value='Search'> </form> </div>
Lines like the following do not work as expected.
<option value='Guess' {{ selected = ''; if Form.Types | array.contains 'Guess'; selected = 'selected'; end; selected }}>Guess</option>
Instead we have to do the following to marshall the array to an array of strings.
<option value='Guess' {{ selected = ''; if Form.Types | array.each @string.strip | array.contains 'Guess'; selected = 'selected'; end; selected }}>Guess</option>
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Given an object like:
And a template like:
Lines like the following do not work as expected.
Instead we have to do the following to marshall the array to an array of strings.
The text was updated successfully, but these errors were encountered: