This is my situation :
<form action=“destinationpage/”>
<select name=“localita” id=“localita” >
<option></option>
{exp:channel:entries channel="localita"}
<option>{nome_localita}</option>
{/exp:channel:entries}
</select>
</form>
How can i get the select value not using php on my action form page?
I need to have : mywebsite.com/destinationpage/SELECTVALUE
Many thanks for your help!
Related
I have a select box. On select select box value my page will reload. How can I handle this situation in sails.js .
I am new in sails.js. Please give some solutions if anyone can do.
<select name="gender" id="gender" onChange={this.handleChange.bind(this)}>
<option value="">Select Gender</option>
<option value="M" <%= (gender == 'M')? 'selected':'' %>>Male</option>
<option value="F" <%= (gender == 'F')? 'selected':'' %>>Female</option>
</select>
You either need to use some frontend framework, or, if you want to use the embedded ejs, then in your assets/js folder add jquery and in your view add a script tag in which you can add an onChange event handler to your select.
At this moment I'm working on a project where we use Aurelia in combination with Material Design Components. Because the project is fairly new, we are using MDC version 0.13.
We are using multiple select fields and some of them should have an initial value, like the snippet below:
<select value.bind="_PersonID" class="mdc-select mdc-list-item__end-detail">
<option model.bind="null">Select person</option>
<option repeat.for="person of Persons" model.bind="person.ID">${person.Name}</option>
</select>
This works great and like we expected it to work. But now we want this kind of behavior with the mdc-select structure & styling. For that we use the following:
<div mdc-select role="listbox" class="mdc-select mdc-list-item__end-detail">
<span class="mdc-select__selected-text">????</span>
<div class="mdc-simple-menu mdc-select__menu">
<ul class="mdc-list mdc-simple-menu__items">
<li class="mdc-list-item" role="option" repeat.for="person of Persons" model.bind="person.ID">${person.Name}</li>
</ul>
</div>
</div>
The problem with this piece is that we've only a "CurrentPersonId". But we have to define the name in the tag. In the documentation of MDC, it also declares an "aria-selected" attribute in the li. When we put that on the li tag, it won't update the span on init.
I can't seem to find a way to edit the localised strings using the provided template editor , does anyone have any pointers on this ?
For example if I wanted to change the text 'search products' to something else for example... Where/How can I edit the template and its data ?
Thank you
Le Roi
The ugly way to do this:
Edit the template, remove the
<search-control></search-control>
And add a custom text to the input placeholder
<div>
<form action="/Products" class="pull-right" method="get">
<input type="hidden" name="startEditTemplate" value="ProductList">
<div class="form-group has-feedback">
<input placeholder="My Custom Search products" id="pattern" type="search" class="form-control" name="pattern" spellcheck="false">
<button class="glyphicon glyphicon-search form-control-feedback ap-ininput-button"></button>
</div>
</form>
</div>
The bad part about this is that you are now responsible for updating this piece of code and template.
Let's say I have a page with two forms displaying multiple options as below. As it is, bootstrap will allow the user to select two options and pass both fields when the form is submitted.
But I want to force the user to select from one form only, which in my case below means the user can only select a fruit or a drink but not both.
So is there a way to highlight/select only the latest option selected by the user?
I'd like to avoid using scripts if possible.
Thank you for the help.
<form action="/orderfood" method="post" role="form">
<div>
<label>Fruit</label>
<select class="form-control" name="fruit" multiple="multiple">
{{#each food.fruit}}
<option value="{{_id}}">{{food.fruit}}</option>
{{/each}}
</select>
</div>
<div>
<label>Drink</label>
<select class="form-control" name="drink" multiple="multiple">
{{#each food.drink}}
<option value="{{_id}}">{{food.drink}}</option>
{{/each}}
</select>
</div>
</form>
You can add radio buttons to the form and use an event handler to listen on either their changed or theirclick event and show the <select> that matches the currently selected radio button.
I have this entry form
{exp:safecracker channel="channel_name" return="url/ENTRY_ID" entry_id="{segment_3}" author_only="yes" include_jquery="no" class="nice"}
<label for="title">Week Title</label>
<input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" class="input-text">
<label for="challenge">Select Challenge</label>
<select name="challenge">
<option value=""> -- </option>
{exp:channel:entries channel="channel_name2" username="CURRENT_USER" dynamic="no"}
<option value="{entry_id}">{title}</option>
{/exp:channel:entries}
</select>
...
{/exp:safecracker}
"Challenge" field dropdown returns {entry_id} correctly but not the {title}. {title} params is blank.
Any tips?
You are encountering namespace collision - {title} is populated first by your Channel Entries tag, but then overwritten by SafeCracker, as it's the outermost module tag. {entry_id} will also fail once you're editing an existing entry rather than creating a new one.
Solve this by embedding your Channel Entries tag (a snippet, as suggested by pvledoux, will not help in this case).
Nesting channel:entries in safecracker is maybe not the best way.
You'll probably get better result if you put your channel:entries tag in a snippet.