struts 2.0 allow HTML in label of s:checkbox - forms

I have a checkbox for agreeing to the terms and conditions of a contenst, and the user wants the terms linked in the label. I've attempted to do something like this:
<s:checkbox name="iagree" fieldValue="true" label="By entering, I acknowledge that I have read, understand, and agree to the
<a href='/rules.pdf'>Official Rules</a>, <a href='/about-us/terms-of-use/'>Terms of Use</a>, and <a href='/about-us/privacy-policy/'>Privacy Policy</a>."/>
Unfortunately, the JSP is escaping my markup, and so you actually see the brackets, tags, etc. Is there an attribute I can add to make sure that the HTML is actually used as HTML?
Curiously, I have a struts radio group, and it is allowing markup just fine.

Just use HTML <label> tag and place checkbox along with text and links inside it. And use simple theme for the <s:checkbox> tag.
<label>
<s:checkbox name="iagree" fieldValue="true" theme="simple"/>
By entering, I acknowledge that I have read, understand, and agree to the
<a href='/rules.pdf'>Official Rules</a>,
<a href='/about-us/terms-of-use/'>Terms of Use</a>,
and <a href='/about-us/privacy-policy/'>Privacy Policy</a>.
</label>

Related

VoiceOver won't read information from aria-* attribute for <div> or <p>

I want some mobile page to be read via VoiceOver(Safari) and TalkBack(Chrome) in browser.
html code:
<span id="label_span">some description</span>
<p aria-labelledby="label_span">
<span>main text</span>
</p>
Instead of reading 'main text' I need screen reader to read 'some description'.
TalkBack works correctly for me, but VoiceOver(in mobile Safari browser) read 'main text' (even aria-label, aria-describedby doesn't work for me)
How to make VoiceOver system read content of aria-* linked element instead of particular element.
aria-labelledby works with elements that have explicit roles (or implicit roles) and/or are interactive elements. In short, aria-labelledby will not work with either a <div> nor a <span>.
Something like a header (<h#>) would be an example where you can use aria-labelledby to connect its text value to something like a <section>.
Barring an example, I cannot offer much more than that.

Polymer + form POST data

I have this
<form id="form_837299" class="appnitro" method="post" action="insert.php"> <paper-input label="Title" name="title" maxlength="255">
</paper-input>
<paper-input floatinglabel multiline label="text" name="text"></paper-input>
<li class="buttons">
<input type="hidden" name="form_id" value="837299" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
I have problem with POST data - nothing is sended in "text" and "title" (all in paper-input).
I modified the template and attribute "name" now is in one div, which Polymer created. But no data are sent.
print_r($_POST); shows me only this:
Array ( [form_id] => 837299 [submit] => Submit )
Anybody knows how use Polymer and Material UI on form?
Only elements that extend native form elements automatically get submitted with forms. paper-input extends core-input which has an input inside it as opposed to extending it. See this mailing list discussion for additional discussion and this StackOverflow post for possible solutions.
Something like this jsbin maybe?
Update: Here's the same thing in web component form.
Update: Looks like the creator of ajax-form has added this functionality.
Update: Also consider using iron-form.
According to the Polymer docs the way to do this is to just create a regular form input and wrap it in the <paper-input-decorator>
https://www.polymer-project.org/docs/elements/paper-elements.html#paper-input
I've tried it out and it works fine. Some better form support would be cool, but oh well. This stuff still kind of rocks.
UPDATE: I've built a bower package (polymer-rails-forms) to deal with forms in polymer, tailored specifically to the ActiveRecord input naming scheme but it will work with any old form really. It's still relatively new, but it covers most input types, basic validations, xhr and non-xhr submits and has a couple cool extras like image, json, and location* fields.
the location fields depend on the Google Map Places API

Change the url for search input

I have a search form on a Drupal page (A custom view) that searches all my articles:
URL: www.site.com/articles
<form>
<input type="text" placeholder="Search Library" class="searchbox">
<button type="submit" id="edit-submit" name="op" value="Search" class="form-submit">Search</button>
</form>
When a user submits this form I get a string appended to the end of the url like this:
www.site.com/articles?search_fulltext=SEARCHTERM&op=Search
The problem is that it's not working, and to get it to work I have to search from a different page like here:
www.site.com/search?search_fulltext=SEARCHTERM&op=Search
So ultimately I would like to have my search box on a page, but when a user submits I want it to reference another url:
www.site.com/search?search_fulltext=SEARCHTERM&op=Search
I basically want to have a search box on a different page that is being searched. If that makes any sense. :)
Use the <form> tag's action attribute to submit the form to the search page like:
<form action="http://www.site.com/search">
I also just realized that you are probably only looking to search specific content types so you may wish to look into the Custom Search module (http://drupal.org/project/custom_search).

AddThis Facebook like button inside TinyMCE

I'm trying to use Addthis (http://www.addthis.com) script to place things like Facebook "Like" buttons on my pages. When I put the "Like" code in and save it TinyMCE strips part of the code out? For example. This is the Follow Us code.
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
</div>
After I save and check again the fb:like:layout="button_count" section is removed by TinyMCE.
Note: I use TinyMCE within EpiServer CMS 6 R2
Is there a way to fix this?
Thanks.
You will need to configure tinymce not to stripout those attributes.
Have a look at the tinymce configuration parameter valid_elements.

How can I redirect automatically to an other page of my WebApp

I am currently developing a Web App under jQTouch, and I want to know how I should proceed to redirect the user automatically to another page of my Web App.
For instance, let's suppose I have this code :
<div id="foo1">
...
</div>
<div id="foo2">
...
</div>
Now, let's suppose that the currently visible block is foo1. Which code should I write in my JavaScript file to redirect to block foo2 (as though I clicked a link with href="#foo2")?
Thanks and sorry for my English (I'm French).
You may use the jQT.goTo() to transfer to another page, e.g.
jQT.goTo('#foo2', 'slideup');
If you just want to trigger a click event on a link, you could use the click function in jQuery:
<a id="goToFoo2" href="#foo2">Go To Foo2</a>
<script>$("#goToFoo2").click()</script>
A standard link
Link
will not work, but you are on the right track, it just has to be in the correct setting (either a button, or a list). so either:
<ul class="rounded">
<li class="arrow">
Link
</li>
</ul>
or
<a class="button" href="#foo2">Link</a>
will work.