I have the following problem, i have a JSF command button:
<h:commandButton value="#{o.foo}" actionListener="#{someAction}" styleClass="#{row.buttonCssStyle} buttonMenu ">
<f:attribute name="smthing" value="#{o.smthing}" />
</h:commandButton>
This renders as expected
(Sorry for text removal)
But the commandButtons which have ( as last char on a line do NOT linebreak and i dont know how to solve it. We are talking about IE 9
Command buttons generated css:
Any help is highly appreciated, thanks
edit:
from ie debugger:
<input name="formId:we:_idJsp112:_idJsp113:3:_idJsp115" class="missingDatesButtonState buttonMenu " id="formId:afterSales:_idJsp112:_idJsp113:3:_idJsp115" onclick="..." type="submit" _nodup="30804" value="TESTST(RL, EBO und SLP) ( <br/>( ( ( ( ( ( ( asda #### # # # ### # ( asda"/>
Edit #BalusC:
This is the result with line feed:
I consider it is a failure of the IE9 on parsing of the value , when generating the element... since it works for text but not for symbols... I think it is directly related to that....
HTML code inside HTML attributes isn't interpeted as HTML. This isn't a JSF problem.
Just insert a real linefeed character either via
or
in (X)HTML or i18n bundle file,
<h:commandButton ... value="top line
bottom line" />
... or via \n in Java.
<h:commandButton ... value="#{bean.value}" />
value = "top line \n bottom line";
Related
I got this weird problem:
I get content that is dynamically built. In this special case I also get the element "input" as content, which is then displayed directly by the browser as an element.
What I get:
<div class="search_result_content"> this is just text, but the code <input variable="" name=""> displays as an element
What i need:
You may want to add 'type="text"', so total would be like
<input type="text" name="" value=""/>
Else if the input needs to be added to a (like) 'span' or 'div', i would suggest JS or jQuery
$(document).ready(function() {
$(".search_result_content").append('<input variable="" name="">');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="search_result_content"> this is just text, but the code </div>
u insert the input tag dynamically in this scenario, after inserting convert it into html format
I have a submit button with text and I want to check for both.
i.e. the actual page has:
<input class="button" type="submit" value="Continue" tabindex="3"
name="nav[save]"></input>`
So I've tried
it "I can see the Continue button" do
expect(page.find('input[type="submit"]').find('input[value="Continue"]')).to be
end
but I get
Unable to find css "input[value=\"Continue\"]"
and
expect(page.find('input[type="submit"]')).
to have_selector('input[value="Continue"]')
but I get
expected to find css "input[value=\"Continue\"]" but there were no matches
If you want to check for both you can do it in single css selector like
input[type=\"submit\"][value=\"Continue\"]
Here's one solution that works with your view:
expect(find('.button').value).to eq 'Continue'
In the console:
[1] pry(#<Cucumber::Rails::World>)> expect(find('.button').value).to eq 'Continue'
=> true
I would put my JSP file in HTML5 format.
I have a problem with the tag struts radio button;
when I put cssclass"disabled" ( or other like cssClass"red" ) , when I look the source I get twice attribute class="disabled".
But It works nice for the other struts tag.
See example below:
JSP file:
<s:radio cssClass="disabled" name="mirror.swiBlo" list="Y"/>
source:
<input type="radio" name="mirror.swiBlo" id="consultation_mirror_swiBloY" value="Y" class="disabled" class="disabled"/>
If someone has any idea to solve that.
Thanks
Actually it's a bug in struts.
In simple/radiomap.ftl setting of class and style occurs twice.
source code:
<#if parameters.cssClass??>
class="${parameters.cssClass?html}"<#rt/>
</#if>
<#if parameters.cssStyle??>
style="${parameters.cssStyle?html}"<#rt/>
</#if>
<#include "/${parameters.templateDir}/simple/css.ftl" />
And css.ftl handle class and style again.
How to get the attribute of Title in the input element
<input type="image" title="Previous Page">
<input type="image" title="First Page">
<input type="image" title="Next Page">
<input type="image" title="Last Page">
What have you tried? Typically something like the following should work:
WebElement element = driver.findElement(By.tagName("input"));
String title = element.getAttribute("title");
The answer provided by Jim Evans is the correct one imo, but for a more specific one i'd advise something like below. Remeber that copy-pasta might not work and you need to change something to be able to work on your full HTML.
List<WebElement> elements = driver.findElements(By.tagName("input"));
for (WebElement element : elements) {
if (element.getAttribute("type").equals("image")) {
System.out.println(element.getAttribute("title"));
}
}
The above code will loop for all the in your webpage that are from type="image" and print on the console the "title" attribute of each one of those.
Still thing you should vote Jim's answer as the correct one though.
First, you need to identify the input element from which you want to get the value of the attribute title .
Then something like the following must work.
element.getAttribute("title");
Its very simple and work for as well.
String title = driver.getTitle();
I'm trying to convert a raw string to html with the Liquid templating language. What I want to do is convert this:
Hello. This
is a text.
Please convert me.
into this:
<p>Hello. This<br />
is a text.</p>
<p>Please convert me.</p>
What I tried
{{ mytextvariable | newline_to_br | replace: "<br />\n<br />", "</p><p>" | replace: "<p></p>", "" | prepend: '<p>' | append: '</p>' }}
but this gives me (notice double <br />):
<p>Hello. This<br />
is a text.<br />
<br />
Please convert me.</p>
Site note
This will be used for a Shopify site.
You're replacing new lines with break tags when using newline_to_br, so the first replacement won't replace anything, newlines are gone.
From what I can see, Liquid does not support regular expressions, so the replace: "<br />\n<br />" will probably be interpreted literally.
Might be easier to implement as a new filter?
... something like this:
def newline_to_p_or_br(input)
input.to_s.gsub(/(.*?)\n\n/, "<p>\1</p>").gsub(/\n/, "<br />\n")
end
Here is the definition of newline_to_br for reference:
http://rubydoc.info/gems/liquid/2.2.2/Liquid/StandardFilters:newline_to_br