I am using the wheelnav.js library. Some of the items in the wheel have text which needs to be wrapped onto a new line due to the length being too long.
I have tried using the <br /> html tag but it is rendered as text.
You have to use \n.
myWheelnav.createWheel(["Short text","This is a\nlong text"]);
Related
The page contains a multi-select dropdown (similar to the one below)
The html code looks like the below:
<div class="button-and-dropdown-div>
<button class="Multi-Select-Button">multi-select button</button>
<div class="dropdown-containing-options>
<label class="dropdown-item">
<input class="checkbox">
"
Name
"
</label>
<label class="dropdown-item">
<input class="checkbox">
"
Address
"
</label>
</div>
After testing in firefox developer tools, I was finally able to figure out the xPath needed in order to get the text for a certain label ...
The below XPath statement will return the the text "Phone"
$x("(//label[#class='dropdown-item'])[4]/text()[2]")
The label contains multiple text items (although it looks like there is just one text object when looking at the UI) in the label element. There are actually two text elements within each label element. The first is always empty, the second contains the actual text (as shown in the below image when observing the element through the Firefox developer tool's console window):
Question:
How do I modify the XPath shown above in order to use in Selenium's FindElement?
Driver.FindElement(By.XPath("?"));
I know how to use the contains tool, but apparently not with more complex XPath statements. I was pretty sure one of the below would work but they did not (develop tool complain of a syntax error):
$x("(//label[#class='dropdown-item' and text()[2][contains(., 'Name')]]")
$x("(//label[#class='dropdown-item' and contains(text()[2], 'Name')]")
I am using the 'contains' in order to avoid white-space conflicts.
Additional for learning purposes (good for XPath debugging):
just in case anyone comes across this who is new to XPath, I wanted to show what the data structure of these label objects looked like. You can explore the data structure of objects within your webpage by using the Firefox Console window within the developer tools (F12). As you can see, the label element contains three sub-items; text which is empty, then the inpput checkbox, then some more text which has the actual text in it (not ideal). In the picture below, you can see the part of the webpage that corresponds to the label data structure.
If you are looking to find the element that contains "Name" given the HTML above, you can use
//label[#class='dropdown-item'][contains(.,'Name')]
So finally got it to work. The Firefox developer environment was correct when it stated there was a syntax problem with the XPath strings.
The following XPath string finally returned the desired result:
$x("//label[#class='dropdown-item' and contains(text()[2], 'Name')]")
I've made an expander component using Vue.js and I need to line break some of the answers. How would I add the line-break tag properly into the slot string? As of now they naturally show up as a string:
<expander identifier="pricing" question="This a question?" answer="This is an answer that really needs a <br/> tag."></expander>
You could apply the white-space: pre-wrap style to the element that you're rendering the answer string into, then you can use newlines in the answer string like this:
<expander :answer="'This is an answer that really needs a \n tag.'"></expander>
See Image for discription Discription is in image its all about the input form value not persist properly in vue it shows Unicode
You cannot use interpolation inside html tags. Go for v-bind:value:
<input type="text" name="check" v-bind:value="item.name"></input>
Also you are opening an input, but closing with span
So I'm using the following code to create a PDF from data from a query.
<cfpdfform action="populate" source="test.pdf" destination="GeneratedPDFs/test.pdf" overwrite="yes">
<cfpdfformparam name="FirstLine1" value="#Variables.FirstLine#">
<cfpdfformparam name="SecondLine1" value="#Variables.SecondLine#">
<cfpdfformparam name="AddressBox1" value="#Variables.AddressBox#">
<cfpdfformparam name="Body1" value="#Variables.Body1#">
<cfpdfformparam name="FirstLine2" value="#Variables.FirstLine#">
<cfpdfformparam name="SecondLine2" value="#Variables.SecondLine#">
<cfpdfformparam name="AddressBox2" value="#Variables.AddressBox#">
<cfpdfformparam name="Body2" value="#Variables.Body2#">
</cfpdfform>
<cfpdf action="write" source="GeneratedPostCards/!PostCard2013-Vipre.pdf" destination="GeneratedPostCards/!PostCard2013-Vipre-flat.pdf" flatten="yes" overwrite="true">
</cfpdf>
This works fine, and generates the PDF for me, but I've run into three issues:
If I set a form field in Acrobat Pro DC to a Rich Text, then no matter what font I select, I get Courier. In order to get the font I want, I have to turn off Rich Text.
I'd like to change the line spacing or leading in the multi-line fields, but I don't see a way to do that (either in Acrobat or in ColdFusion).
I'd like to be able to bold, italicize, and change the colour of specific words (not the entire field) and I'm wondering if there are codes I can pass from ColdFusion to do this.
Thanks!
Keep in mind that if you set the richText flag of a text field, you will have to use richValue for the value, and richValue is an array of span objects, where each object represents a piece of the text with specific properties. The Acrobat JavaScript documentation is your friend…
As it is not really possible to directly insert arrays into a PDF form, you might consider representing the richValue arrays as strings, and fill them into hidden "shadow fields". When the document opens, some logic interprets those strings, and fills the richText enabled fields with correct richValue arrays.
It may also be good to know that there is no richDefaultValue property, which means that you would have to recreate the richValue when you reset the form.
I have some slightly funky UI for inputting tags for a blog post: as tags are entered into an input field they are wrapped into spans that make them look nice by surrounding them in a stylized box, the end result comes out to be something like this:
http://forr.st/posts/OLs/original
Now, this input field (call it field 1)is not part of the form that gets submitted to the controller (I'm using RoR btw) for two reasons: it contains extraneous html tags, besides the actual tags; also if it was part of the form pressing enter would submit the form instead of triggering the js that wraps the entered tag into a span.
So what I'm doing is when each tag is entered, I copy its value (via js) to a hidden input field that IS part of the tag entry form, and when submitted would contain only the tag values and nothing else. The question is: What should I use as delimiter to separate the tags in the hidden input field. Currently I'm using ';' but if a tag itself contains ; that'd cause problems.
I'm also open to suggestions about the general method of how to keep track of the tags entered into 'field 1'
Thanks a lot,
I would recommend just adding a hidden input for each tag.
<input type="hidden" name="post[tags][]" value="tag_name" />
<input type="hidden" name="post[tags][]" value="tag_name" />
<input type="hidden" name="post[tags][]" value="tag_name" />
then in rails
post.rb
def tags=(value)
tag_array = [*value]
# then just filter these out.
end
I use a similar method with the tokenInput jQuery plugin. But in my case I've placed it inside the form. I solved the problems that you mentioned by capturing the keypress event and preventing it for that input and I ignore the search input value.
The one thing that I really like about keeping it inside the form is how it is managed afterward. I place the hidden tag, name, and a remove 'x' in a span (like you mentioned) and then just remove this tag when the 'x' is clicked. I like this because the name and the hidden_tag are removed at the same time.
Just one other tip. If you can, pass the tag_id in the hidden field. This way you don't have to add the tags attribute add all: <input type="hidden" name="post[tag_ids][]" value="tag_name" />.