I'm using WYSIHTML5 editor. Field value was imported to the database and now I want to display it to user.
Value saved in db:
Abstract<br />Introduction<br />Material and methods<br /><br /><br />Material studied<br /><br />Treatment of material<br /><br />
Value in editor:
Abstract<br>Introduction<br>Material and methods<br><br><br>Material studied<br><br>Treatment of material<br><br>
As you can see
<br />
was replaced by
<br>
The thing is that we notify user if he changed value of the field and didn't click "save". Since we compare texts, this difference in br tag counts and I want to avoid it.
Is there any way to turn it off in wysihtml5?
Related
I'm trying to get a conditional to work in a Magento email template, but for whatever reason, I can't get the 'if' to evaluate to true. In my template, I have:
Shipping Method:{{var order.shipping_method}}<br /><br />
{{if order.shipping_method=="wsastorepickup_wsastorepickup"}}
Run this<br /><br />
{{else}}
WTF, OVER?<br /><br />
{{/if}}
When Magento sends the email it has:
Shipping Method:wsastorepickup_wsastorepickup
WTF, OVER?
I've tried it with and without the 'var' in the conditional. What am I missing?
I have been having trouble with a bit of classic asp code
pretty much what I want to do is when a hidden field has a value of 1 a message is displayed
here is the code i have:
<% if (CStr(Request.form("HiddenLog")) = CStr("1")) then %>
<br /> <p style="color:Red;">Message here</p>
<%end if %>
<input type="hidden" id="HiddenLog" value="1" />
The result is nothing appears on screen however if I add an else to the if statment like so
<% if (CStr(Request.form("HiddenLog")) = CStr("1")) then %>
<br /> <p style="color:Red;">Message here</p>
<%else%>
<br /> <p style="color:Red;">Message here</p>
<%end if %>
The message always appears (of course this was to prove that the if statment is working and that the problem most likly is with getting the form values), can someone please tell me what it is I have done wrong
Thanks
Edit A couple of people have asked about my form so I will post that here as well
<form id="form1" method="post">
all the controls are contained inside this form
you have to give the input field a name attribute. you only have an id attribute this is not posted so just use
<input type="hidden" id="HiddenLog" name="HiddenLog" value="1" />
I would like to do multiple rows selection. Rows are display through strut2 tag s:iterator, how can I get the selection information, which should contains a list of selected "id"
<s:form action='Selection'>
<s:iterator value="transInfos">
<input type='hidden' name=id value='<s:property value="id" />' />
<s:checkbox name="selected"/>
<s:property value="name" />
</s:iterator>
<s:submit value="Selection" />
</s:form>
One option which seems to me is to create a hidden field in your form like
<s:form action="selection">
<input type='hidden' name="selectedId" value=""/>
</s:form>
you can add a on-click event to your check-box and if it get checked you can add the value t a variable and set in the hidden field,each new addition should be added as new values in comma separated way like in end hidden field should be like
<input type='hidden' name="selectedId" value="1,2,3,4"/>
moment you submit the form you can parse the form value and can split it based on the separator ","
other option is to name the check-box with same name so moment it will get submitted the values of the checked one will be submitted as a collection, choice is all yours and you need to decide which way to go
I'm glad I can answer this question myself.
The answer is quite simple.
<s:form action="..." >
<s:iterator value="transInfos">
<input type="checkbox" name="transIds" value='<s:property value="transID" />'/>
</s:iterator>
<s:submit value="Select"/>
</s:form>
the value of checkbox is what you want to pass to the action, all the selected checkboxes will pass their values as a list to the action.
I have a 'customer' form which has a section called 'contacts'. To start with this contacts section will contain the following elements..
<input type="text" name="contacts[0][fname]" />
<input type="text" name="contacts[0][sname]" />
But the user may want to add another contact which will duplicate the elements with javascript to produce the following:
<input type="text" name="contacts[0][fname]" />
<input type="text" name="contacts[0][sname]" />
<br />
<input type="text" name="contacts[1][fname]" />
<input type="text" name="contacts[1][sname]" />
I know how to produce the first set of elements, however if the form gets submitted and there are errors, how can i ensure that the correct number of 'contacts' elements get rendered?
Ive never had to do this with Zend_Form but i have done it with Symfony 1.4's sfForm which has a similar API and theory of operation. Based on that the basic process is:
In the parent forms constructor intialize some default number of subforms. Youll want to separate out the logic for actually creating and embedding n subforms into a separate method(s). Ill refer to this as the method emebedContacts($count = 1)
Override the isValid and setDefaults methods on the parent form so that they detect the number of subforms in the $data arguments passed to them and then call embedContacts before calling parent::isValid() or parent::setDefaults().
Hope that helps.
We have the following code in which we are getting errors in the w3c validator for "Any input descendant of a label element with a for attribute must have an ID value that matches that for attribute." and "The label element may contain at most one input, button, select, textarea, or keygen descendant." Is this something that should just be ignored by the validator (as it is seeminlgly correct) or should it be changed to appease the w3c? Note this is html5 doctype.
<fieldset>
<label for="user_is_subscribed">
<input type="hidden" value="0" name="user[is_subscribed]">
<input type="checkbox" value="1" name="user[is_subscribed]" id="user_is_subscribed">
Newsletter Signup
</label>
<span class="checkLabel">We will never spam or give away your information</span>
</fieldset>
Thank in advance!
Labels should contain at most one input element. Move the hidden input out of the label. Also, when an input is a descendant of a label, the for attribute is superfluous.
<fieldset>
<input type="hidden" value="0" name="user[is_subscribed]">
<label>
<input type="checkbox" value="1" name="user[is_subscribed]" id="user_is_subscribed">
Newsletter Signup
</label>
<span class="checkLabel">We will never spam or give away your information</span>
</fieldset>
Is this something that should just be ignored by the validator
No
(as it is seeminlgly correct)
It isn't
or should it be changed
Yes
to appease the w3c?
No. It should be changed because it is wrong, and browsers have to error correct to figure out which element the label is associated with.
The label isn't labeling the hidden input, move it elsewhere.