No validation working on the form inside the jQuery UI dialog - forms

No validation plugin is working on the form contained inside a jquery Ui dialog box. Using Bassistance jQuery validation plugin, works great out of the ui modal box, no luck working it on the form contained inside the jQuery Ui modal box, nor the validate.js method is working. What might be wrong? Almost pulling hair out for this

Ok, this was not a jquery or any js problem.
The html was not formated properly, the form element was "inside" a table which didnot work,
always have form element enclose a table
<form>
<table>
<tr>
<td><!--input element here--></td>
</tr>
</table>
</form>
and not
<table>
<form>
<tr>
<td><!--input element here--></td>
</tr>
</form>
</table>
If you are enclosing form inside a table cell, it should be ok.

Related

UI Bootstrap datepicker - adding tooltip (ui bootstrap tooltip) for every day

I was trying to do that by adding an attribute of uib-tooltip to Datepicker, but after I saw the code I've seen that it isn't the proper way to do that...
Anyone have an idea for doing that?
Thanks a lot!!
I've never done so myself but I think you could just override the default datepicker templates and just add a tooltip there
they can be found here.
then you can go to the day view template and add a tooltip next to ng-repeat="dt in row"
<td ng-repeat="dt in row" uib-tooltip="hello tooltip"class="uib-day text-center" role="gridcell"
id="{{::dt.uid}}"
ng-class="::dt.customClass">
<!--<button type="button" class="btn btn-default btn-sm"
uib-is-class="
'btn-info' for selectedDt,
'active' for activeDt
on dt"
ng-click="select(dt.date)"
ng-disabled="::dt.disabled"
tabindex="-1"><span ng-class="::{'text-muted': dt.secondary, 'text-info': dt.current}">{{::dt.label}}</span></button>-->
</td>
If you are using the minified version of ui-bootstrap you're going to have to manipulate some of the component's source and minify it yourself

Mailchimp mc:hideable hides the wrong section within repeatable block

I've built a custom mailchimp template and added repeatable and hideable sections so my client can edit it more easily. I have read all the documentation, my code validates, and the email itself functions great, except for one problem. Here's the gist of my layout - and ideally how I would like it to work (all extraneous code removed - but I can supply it separately if needed).
<table mc:repeatable>
<tr>
<td><img src="" alt="article image"></td>
</tr>
<tr>
<td>
<h2 mc:edit="article_title" mc:hideable>Optional Title</h2>
<div mc:edit="article_body" mc:hideable>Optional content</div>
</td>
</tr>
<tr>
<td>
<div mc:edit="article_button" mc:hideable>Optional Styled Button</div>
</td>
</tr>
</table>
When I go into the campaign editor, I can hide sections successfully. UNTIL I duplicate the block. Once I have 2 blocks, and I hide the 1st block's h2, it hides the following div. If I hide the div, it hides the button. Note: within campaign editor it appears to hide things properly. Only when I preview the email can I see that it's hiding the wrong sections.
I have tried every variation I can think of:
Nesting tables for each piece of hideable content
Separating the edit and hideaable tags to parent/child elements
Renaming all the mc:edit attributes
Moving mc:repeatable to the tr or nested tables instead
Removing mc:hideable completely, except for the button (So they would delete copy rather than hiding the whole section.)
Item 5 above resulted in a completely different problem. When I duplicated the block and hid the button on the replicated block, it hid the button in the FIRST section. It's like the names are getting crossed somehow.
There's gotta be something I'm missing. Mailchimp's documentation seems really straightforward and I haven't been able to find anything about this specific issue.
Thanks in advance!
As a workaround instead of creating mc:hideable elements inside the mc:repeatable block I've created multiple variants using mc:variant, and each variant has different items inside it.
So in your example your varients would be:
Block
Block with title
Block with content
Block with button
Block with title and content
Block with title and button
Block with title and content and button
Block with content and button
This is not quite as neat as a solution but it does work.
See here for mc:variant syntax.

mootools clone form element

I cannot get a form to submit additional fields that have been cloned. When a form like the one below is submitted, it does not include the cloned form elements. Does anybody know why and how I can alleviate this issue.
<form>
<table>
<tr><td><input type="text" value="50" name="myvar[]" /></td></tr>
<!-- This button will clone the previous set of form elements -->
<tr><input type="button" value="Add New Line" onclick="this.getParent('tr').getPrevious('tr').clone().inject(this.getParent('tr'), 'before')" /></tr>
</table>
</form>
Your HTML isn't well formed, so this.getParent('tr') is returning null at least for me in Firefox. Put the button inside a td that is inside the tr and it works.
JSFiddle: http://jsfiddle.net/delvarworld/r99fN/ clicking the button throws an error
Thanks for the comment but the form was meant to be an example not actually what I had. I looked back at the form and the top form element was inside the table and the bottom form element was outside of the table. I moved the top form element outside of the table and everything works perfectly.
thanks,

Using anchor link for form submission

Can i use an anchor tag to submit a form? In this code i am using a submit button which is standard but how to use a anchor tag <a href=Cart?removeId=${cartItem.productId>Remove</a>
I tried this, but the doGet() method is being called in the servlet. I want to call the doPost() method obviously. So could i use a better approach.
<c:forEach items="${lstCart}" var="cartItem" varStatus="count">
<form action="Cart" method=Post>
<tr height="40px">
<td>${count.count}</td>
<td>${cartItem.productName}</td>
<td>${cartItem.quantity}</td>
<td>${cartItem.unitPrice}</td>
<td>${cartItem.totalPrice}</td>
<td>
<input type="hidden" name="id" value="${cartItem.productId}" />
<input type=submit value="x"></td>
</tr>
</form>
</c:forEach>
You need to use JavaScript to make an anchor link do a post. You might use CSS to style your submit button and make it look more like a link, though.
Yep as #JB said you can post the form using JScript. One example that comes to my mind is below with struts, here you are actually passing the product id as a variable to JS method (I changed the names so it matches your example).
<a href="#" onclick="removeProduct(${cartItem.productId})">
Remove
</a>
You can then have JS method to be
function removeProduct(productId) {
document.forms["formname"].elements["productId"].value =
productId;
document.forms["formname"].submitTestPost.click();
}
This also assumes the following is defined in the page (so JS can set it) and the submit property (tag SubmitTag). I am not sure in your case the setup but perhaps you can draw some points.
<input type="hidden" name="productId"/>

mvc : control specific required validation

I am using mvc 2.0 with C#.Net
In my view page, I am creating multiple controls with required field validations. to plot my controls, I am using for loop through my mode object which is actually a collection of business object. For my TextBox control which represent 'user comments', I have put validation under it. like
<%:Html.TextBoxFor(model=>model.mycollection[i].Comment %>
<%:Html.ValidationMessageFor(model => model.mycollection[i].comments) %>
There is a sumit button for each row (for each comment textbox) like below
<input runat="Server" name="Button" id="Submit1" type="submit" class="button" value="save comments">
When the form loads, 3 rows are created, each containing a set of text box and a button to submit. This is because the model is a collection of 3 objects. So now I can submit each comments entered by user individually. But the problem is, when I click on any button, instead of validating corresponding textbox for required validation, it validates all of the textboxes on page at a time and gives error message for all of them. How to avoid this kind of behaviour? Mypage has a html.beginform method on top to put everything in a single form and to post the submit to an controller action.
Can you try to put each object from your collection in a separate form like this:
<table>
<% foreach(person in Model.Personlist) { %>
<tr>
<td>
<form>
<%=Html.TextAreaFor(...) %>
<%=Html.ValidationMessageFor(...) %>
<input type="button"......></input>
</form>
</td>
</tr>
<% } %>
</table>
..so then only that form will be validated when you click submit.
Also you can use divs instead of table .