I am using .Net3.5. I have a scenario where user selects the textbox the Ajax calender pops up. In that calender i just want to display only next two weeks. not entire month or year. How to do that?
<tr>
<td>
</td>
<td align="left">
Next Update Date
</td>
<td align="left">
<asp:TextBox ID="txtEditUpdateDt" runat="server"></asp:TextBox>
<cc2:CalendarExtender CssClass="AjaxCalendar" OnClientShowing="DisplayDateToday"
ID="CalendarExtender3" runat="server" PopupButtonID="txtEditUpdateDt" PopupPosition="BottomLeft"
TargetControlID="txtEditUpdateDt" Enabled="True" />
<asp:RegularExpressionValidator ID="valtxtEditUpdateDt" runat="server" Display="None"
ControlToValidate="txtEditUpdateDt" ErrorMessage="Please enter valid Date." ValidationExpression="((^(10|12|0?[13578])([/])(3[01]|[12][0-9]|0?[1-9])([/])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(11|0?[469])([/])(30|[12][0-9]|0?[1-9])([/])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(0?2)([/])(2[0-8]|1[0-9]|0?[1-9])([/])((1[8-9]\d{2})|([2-9]\d{3}))$)|(^(0?2)([/])(29)([/])([2468][048]00)$)|(^(0?2)([/])(29)([/])([3579][26]00)$)|(^(0?2)([/])(29)([/])([1][89][0][48])$)|(^(0?2)([/])(29)([/])([2-9][0-9][0][48])$)|(^(0?2)([/])(29)([/])([1][89][2468][048])$)|(^(0?2)([/])(29)([/])([2-9][0-9][2468][048])$)|(^(0?2)([/])(29)([/])([1][89][13579][26])$)|(^(0?2)([/])(29)([/])([2-9][0-9][13579][26])$))"></asp:RegularExpressionValidator>
<cc2:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server" Enabled="True"
TargetControlID="valtxtEditUpdateDt">
</cc2:ValidatorCalloutExtender>
</td>
<td>
</td>
</tr>
Like #Dario said, I don't think you can't limit it in the simple ajax control. An alternative option would be to add a range validator.
<asp:RangeValidator ID="RangeValidatorDT"
runat="server"
ControlToValidate="txtEditUpdateDt"
ErrorMessage="* Invalid date range"
Type="Date">
</asp:RangeValidator>
Then on the page load
RangeValidatorDT.MinimumValue = System.DateTime.Now.ToShortDateString()
RangeValidatorDT.MaximumValue = System.DateTime.Now.AddDays(15).ToShortDateString()
According to what I know you can't do it, this calendar extender is very easy to use, but very limited, if you use the Calendar control you would be able to enable only the days that you want.
Related
I want to append an element to a specific element when the user clicks the button. The scenario goes like this. Is there another way to deal with that kind of problem?
<table>
<tbody>
<tr>
<td>
One
<button>delete</button>
<button x-on:click="edit(passIdToFunc)">edit</button>
</td>
</tr>
<tr id="one" style="display: hidden"></tr>
<!-- append x-teleport dom node to here when current value is id = one -->
<tr>Two</tr>
<tr id="two" style="display: hidden"></tr>
<tr>Three</tr>
<tr id="three" style="display: hidden"></tr>
...
</tbody>
</table>
<!--
For the initial render, or if there is no table data,
I would like to append it to somewhere else with display none.
-->
<template x-teleport="computedString">
...
</template>
This looks like the wrong usage for x-teleport, though it's not clear from the example where you are teleporting to. You can just use x-show to toggle display:none if that's what you're looking for.
I need to modify the format of a form in a model-driven app to make it more readable/intuitive. Currently, the form looks like this:
I tried to use a web resource to create a simple HTML table with <script> and Xrm.Page.getAttribute() to pull in the relevant fields under the planned and actual columns, but that isn't working. I set the dependencies and assigned it to the proper form element, but no luck. The code that I used is this:
<div>
<table>
<tr>
<td><u>Tasks</u></td>
<td><u>Planned</u></td>
<td><u>Actual</u></td>
</tr>
<tr>
<td>Task 1</td>
<td><script>Xrm.Page.getAttribute("[plannedField_1]")</script></td>
<td><script>Xrm.Page.getAttribute("[actualField_1]")</script></td>
</tr>
<tr>
<td>Task 2</td>
<td><script>Xrm.Page.getAttribute("[plannedField_2]")</script></td>
<td><script>Xrm.Page.getAttribute("[actualField_2]")</script></td>
</tr>
<tr>
<td>Task 3</td>
<td><script>Xrm.Page.getAttribute("[plannedField_3]")</script></td>
<td><script>Xrm.Page.getAttribute("[actualField_3]")</script></td>
</tr>
</table>
</div>
Is this a valid way to modify form output, or is there another/better way to do this that doesn't involve creating an elaborate solution with dynamically scripted HTML?
Uncheck the Display label on the form for one of the controls.
I have a query regarding Jmeter regex extractor. I am trying to implement 1 scenario however not able to do same. Below are the details:
Requirement :
In Jmeter I have defined user defined variable : String VAR = KZ
now I am trying to use Regex extractor so that from the HTML response, regex will match VAR value in HTML(defined below) and will fetch span class name, as I need to set checkbox ON for KZ.
Requirement is to handle checkbox ON functionality through user defined variable, that means I don't want to hardcode class name instead based on user defined variable(which will be td value i.e. in this example KZ) I have to fetch class name using Regex Extractor. Could someone please help how to proceed?
Below is HTML Code:
<tr class="trClass">
<td style="width: 13.5%;">
<span class="checkbox"><input id="ctl00ctl94" type="checkbox" name="$ctl95$"
onclick="return validatecheck();" /></span>
</td>
<td style="width: 41.2%;"> KZ </td>
<td style="width: 0%; display: none;"> 5581357 </td>
<td style="width: 32%;"> 06/03/2018 2:22:38 PM </td>
</tr>
<tr class="trClass">
<td style="width: 13.5%;">
<span class="checkbox"><input id="ctl00ctl95" type="checkbox" name="$ctl95$"
onclick="return validatecheck();" /></span>
</td>
<td style="width: 41.2%;"> TM </td>
<td style="width: 0%; display: none;"> 5581358 </td>
<td style="width: 32%;"> 06/03/2018 2:22:38 PM </td>
</tr>
<tr class="trClass">
<td style="width: 13.5%;">
<span class="checkbox"><input id="ctl00ctl96" type="checkbox" name="$ctl96$"
onclick="return validatecheck();" /></span> </td>
<td style="width: 41.2%;">TR </td>
<td style="width: 0%; display: none;"> 5581359 </td>
<td style="width: 32%;"> 06/03/2018 2:22:38 PM </td>
</tr>
Using regular expressions for parsing HTML is not the best idea as:
they are hard to develop and/or maintain
they are very sensitive to markup change hence fragile, i.e. if order of attributes changes or something will go to a new line - it will simply ruin your regex
So I would recommend going for another post-processor which can work with DOM directly, for instance XPath Extractor
The relevant XPath query which will fetch the classname of span which is above the KZ text would be something like:
//td[contains(text(),'KZ')]/preceding::*/span/#class
Of course you can substitute KZ with the JMeter Variable reference, i.e.
//td[contains(text(),'${VAR}')]/preceding::*/span/#class
However you will not be able to test your queries using XPath Tester mode of the View Results Tree listener, you will have to go for Debug Sampler instead to visualize the resulting variable.
Check out XPath Tutorial and Using the XPath Extractor in JMeter guide to get familiarized with XPath language.
Also be aware that according to JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages.
So I don't believe fetching the span classname will solve your problem, most probably you will need to send underlying input name as a parameter so you should be looking for
//td[contains(text(),'KZ')]/preceding::*/span/input/#name
I am trying to parse the following HTML using Ruby and Nokogiri:
<div class="vevent">
<table width="750"><tr>
<td width="25"> </td>
<td valign="top" width="200">
<font size="2" face="sans-serif">
<font color="black"><b>June 30, 2015</b></font>
<br>
<span class="dtstart"><span class="value-title" title="2015-06-30"></span></span><br><span class="summary"><font color="#92161" size="3"><b>Band Concert</b></font></span>
<br><font color="#333333">Event</font><br>
<br>
<br>
<br clear="left">Have a question? email us.<br>
<br></font>
</td>
<td valign="top" width="10"></td>
<td valign="top">
<br clear="left"><font color="#92161">111 Main Street</font><br>
<font color="#92161">Mainstreet, Ohio 55111</font>
<a rel="nofollow" href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=%221700+111+MainStreet+NE+Mainstreet,+Ohio+55111%22" target="_blank"><font size="1" face="sans-serif">map link</font></a><br><br>
<font color="#92161"><font size="2" face="sans-serif">Telephone:</font> 3305551000</font><br><br>
Visit our website for complete information.<br><br>
Enjoy a summer evening concert on Main Street at 8pm. Doors and cash bar open at 7pm.<br><br>Look for more details and ticket sales to be released soon on our website<br> <br><br>
<br>
</td>
</tr></table>
</div>
I am trying to grab the last bit of text:
Visit our website for complete information.<br><br>
Enjoy a summer evening concert on Main Street at 8pm. Doors and cash bar open at 7pm.<br><br>Look for more details and ticket sales to be released soon on our website<br> <br><br>
Here is my code thus far:
events = doc.css("div.vevent")
events.collect do |row|
row.css("td")[3]
end
This will get me to the third td which has the text that I am looking for as follows:
<td valign="top">
<br clear="left"><font color="#92161">111 Main Street</font><br>
<font color="#92161">Mainstreet, Ohio 55111</font>
<a rel="nofollow" href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=%221700+111+MainStreet+NE+Mainstreet,+Ohio+55111%22" target="_blank"><font size="1" face="sans-serif">map link</font></a><br><br>
<font color="#92161"><font size="2" face="sans-serif">Telephone:</font> 3305551000</font><br><br>
Visit our website for complete information.<br><br>
Enjoy a summer evening concert on Main Street at 8pm. Doors and cash bar open at 7pm.<br><br>Look for more details and ticket sales to be released soon on our website<br> <br><br>
<br>
</td>
However once there if I call text on that td I get all the text inside of the td. I only want the last bit that is not inside any element. I tried using XPath and parent so that I could say "just give me the text that is inside the td (not nested inside of another element)" but I couldn't get that to work. Anyone have any ideas on this?
Try this code: doc.css('td')[3].css('> text()').to_s.strip
I suggest using xpath which is more flexible.
If I understand you correctly, you would like:
I only want the last bit that is not inside any element
So, try this XPath:
//table//td[last()]/text()
I need to align the Ext:TextField control along with its FieldLabel attribute, as right-to-left direction.
By setting LabelAlign to right and body dir="rtl", I can only align all the control to the right.
And I get this format displayed:
---------Label:-|||||||TextField||||||||||
But how can I have the following format?
|||||||TextField||||||||||---------:Label
I'm not quite sure if this is possible as there is no real need for such options.
I would suggest that you leave the Label of the text field blank and that you insert an label to the end...
Example:
<ext:textfield ID="Text1" Text="I start on the left" runat="server" />
<ext:label ID="Label1" Text="I am a label starting on the left staying on the right" StyleSpec="float: left;" />
It should work like this!
FieldLabel will not work for rtl text fields. The only solution found is to enclose a Label and a Text Field inside table cells, aligned in a table row, with dir="rtl" set to the table or container, like the following.
<table dir="rtl">
<tr>
<td>
<ext:Label ID="Label1" Text="Sample Label" runat="server" />
</td>
<td>
<ext:textfield ID="Text1" Text="Sample Text" runat="server" />
</td>
</tr>
</table>