Bind selected option to variable - freemarker

I have a code like this:
<#assign cars = carService.findAll() >
<select name="car">
<#foreach car in card>
<option value="${car.id}">
${car.name}
</option>
</#foreach>
</select>
Is there a way to get the selected car binded to an freemarker variable (in then cars select change event, for example), so I could be able to use it to call another methods?
PS: In the example, carService is an EJB.
Thanks in advance.

Well, no way to do it the way I wanted to.
So, I had to do some JS to deal with it. It works, but it's kinda ugly.
cheers

Related

HTA: Can a Link act as a Select? And How to Store HTA state in a way I can Recover it when I re-open it?

EDIT 2:
Here is exactly what I need:
Change dropdown option with jQuery/Javascript on link click
Whatever, I could not make this to work with the HTA! Any help is much appreciated!
Hello all and thanks in advance for your answers!
I've been working in a self project, and accomplished at least 75% of what I want. Whatever, those two questions on the title are the things that are making me stuck!
Here is one image of how my program looks right now:
Part of my "program"
Ok, as you can see, it has LOTS of drop down menus, and that's ok.
But for ease of use and for questions of aesthetics, I'd like to migrate one of those drop down to the menu on the left.
This select has 5 options, and according to what I chose, it will change something inside a .txt file.
The problem is that I simply CAN'T make this select menu work on the left menu, whatever, as a "select", it work's fine.
Here's an example of the code that's working:
<select size="1" name="OptionChooser43" inputbox id = "searchInput43">
<option value="Equals = 2">Adicionar Expression</option>
<option value="Equals = 3">+ 1 Expression</option>
<option value="Equals = 4">+ 2 Expressions</option>
<option value="Equals = 5">+ 3 Expressions</option>
<option value="Equals = 6">+ 4 Expressions</option>
So, this select works just fine, and changes a part of my .txt with "Equals = &" accordingly.
But if I try to embed it on the left menu, I cant manage it to work.
Here's the code: One of one of the working functions, and another of the non working "select":
Upload
<ul>
<li><a onclick="LoadPreset_1" style="cursor:pointer;">Upload Preset 1</a></li>
<li><a onclick="LoadPreset_2" style="cursor:pointer;">Upload Preset 2</a></li>
</ul>
</li>
*******NON WORKING********
<li><a id="" option value="Equals = 2" style="cursor:pointer;"></option></li>
<li><a id="" option value="Equals = 3" style="cursor:pointer;">+ 1 Expression</option></li></a></div>
I've tried to: Create a new sub for each of the items of the menu, but as soon as I click it, it executes changes to the txt, without execute the changes that I've done with my drop menus.
I tried to use it as a select, but it doesn't answer my commands.
I googled it every way I could think of, no success.
And I even did not want to ask, because it maybe really simple and could make you angry! haha
Second:
I would like to store everything I do on the HTA, in a way that when I open it again, it would be the way I left.
Each drop menu has from 127 to 256 different options, and it would be really nice to have it stored once I open the HTA again!
I also, would like to be able to load the preset-info if I wish.
I've searched how to store data on xml, database... But again, was not successful.
I could go really far alone, but this time I hope you can help me!
Thanks in advance!
Edit: Even after cutting off what I did not need, I still ended up with almost 700 lines, so, here is the attached hta.
HTA File

How to add a new dropdown-value to a Magento SEO-list?

I am using Magento 1.7.0.2 and I want to set a different value for the meta-robots-tag for several products. Therefore I go to Catalog > Article > Meta Information > And select a value from the dropdown "Robots Meta Tag"
Now comes the problem. I just have 4 selectable values in this dropdown, like this:
<select id="seo_meta_robots" name="product[seo_meta_robots]" class=" select">
<option value="0">Don't change</option>
<option value="1">NOINDEX, NOFOLLOW</option>
<option value="2">NOINDEX, FOLLOW</option>
<option value="3" selected="selected">INDEX, NOFOLLOW</option>
</select>
And I'd need a 5th one, labeled "index,follow" - how/where would I need to add that?
Thanks
The easier way would be to copy this file app/code/core/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php into app/code/local/Mage/Adminhtml/Model/System/Config/Source/Design/Robots.php and add the option there:
public function toOptionArray()
{
return array(
array('value'=>'INDEX,FOLLOW', 'label'=>'INDEX, FOLLOW'),
array('value'=>'NOINDEX,FOLLOW', 'label'=>'NOINDEX, FOLLOW'),
array('value'=>'INDEX,NOFOLLOW', 'label'=>'INDEX, NOFOLLOW'),
array('value'=>'NOINDEX,NOFOLLOW', 'label'=>'NOINDEX, NOFOLLOW'),
array('value'=>'INDEX,FOLLOW', 'label'=>'INDEX, FOLLOW'),
);
}
However, the best practise would be creating a Magento Extension and overriding this model to add the option. Since it's a one line code change it probably doesn't worth the effort though, but bear in mind that you might need to maintain changes on this file if you ever upgrade Magento (it's unlikely that this file will be changed).
I hope it helps!

How to add image in dropdown in angularjs

I am working on dropdown with image in angularjs, i tried many solution but havent get any success.
My combo data is coming in json format with three elements id , image and value.
These dropdown numbers are also dynamic as per number of rows are there in model.
Please share the solution for that.
Thanks you.
Please Try this it will work out,
<select ng-model="choice">
<option ng-repeat="item in itemsList" data-image="{{item.url}}">{{item.label}}</option>
<select>
<select ng-model="image_chosen">
<option ng-repeat="data in list" data-image="{{data.url}}" value="{{data.id}}">{{data.value}}</option>
<option value="">Choose a option</option>
</select>
Checkout a example at angularjs select option with custom format value
Hope it helps.
Write like this in option tag
ng-repeat="obj in xxxxComboData" data-image="{{obj.image}}"

Use ::before on a <select name="aaa"> element

I'm editing a css style sheet to use as an override on a template that I have no access to. I am wondering if it is possible to use a ::before on a <select name="aaa"> element that has no class or id to isolate it. Basically trying to put a label/icon before the select menu to make things a bit clearer.
<div class="container">
<select name="selection1">...</select>
<select name="selection2">...</select>
</div>
I've tried too many variations to mention and been hunting about with no luck. So I presume it's not possible. But you never know.
<select> doesn't allow for pseudo ::before or ::after. You can use a javascript solution or wrap each individual in a div. Not the greatest solution, but hope it helps.

Selecting a drop-down option using Selenium IDE

I'm new to Selenium and having a difficult time selecting options from a drop down list (trying to select the second option).
Here is the HTML that I'm working with:
<div id="applicationReasonTypeIDContainer" class="appfield">
<label id="applicationReasonTypeIDLabel" for="applicationReasonTypeID">Application Reason</label>
<select name="appstart_international1:applicationReasonTypeID" id="applicationReasonTypeID" class="AppStart dropdown required" title="Application reason">
<option value="0"> </option>
<option value="1">New Application</option>
<option value="2">Additional location</option>
<option value="3">Owner change</option>
I'm using XPath checker to find the XPath, and it's giving me this but it doesn't work when I try and click or select command
id('applicationReasonTypeID_listbox')/x:li[2]
What should the proper Target be for finding an option like this using XPath?
Thanks Kindly!
If you know the text that will be in the field this is how I do it:
new Select(driver.findElement(By.id("applicationReasonTypeID"))).selectByVisibleText("New Application");
Hope that might help.
edit to add correct id and text from code provided.
What's wrong with either of the following?
new SelectElement(driver.FindElement(By.Id("CustomerDropDown"))).SelectByText("Nationwide");
new SelectElement(driver.FindElement(By.Id("CustomerDropDown"))).SelectByIndex(1);
I actually figured out the problem - it's an issue with Kendo UI not supporting drop-downs properly. Basically the workaround is the click the drop-down arrow, then use sendKeys and point to the same Target as the drop-down with the value being whatever item you want from the list, then clicking the drop-down again. This worked for me, hopefully it helps somebody else!

Resources