Dijit DateTextArea Behaviour - dojo

I am using the dijit dateTextArea and am experiencing some odd behaviour.
I have a simple form with the Dijit dateTextArea. I am setting a default value for the date and it appears fine. If I click into the date area, select a date and hit submit the date is picked up on the other side fine(i.e. it is submitted). If however I don't touch the dateTextArea (i.e. i don't click into it or give it any focus) and submit the form the date is blank, even though the default date has been set. I've tried setting the default date by setting the value on the widget, the initial value and by using data-dojo-props. The date displays in the field but unless I interact with the field the date does not get submitted.
So, what am I doing wrong? Does the field need focus at some point to work properly?
Is there an extra setting I should be using when specifying a default date?
Thanks

It's difficult to tell what's wrong without seeing some code, but you shouldn't have to focus the input or anything for the value to be submitted.
If you look at the "Net" tab in firebug, is the date value part of the request when you submit the form?
I wasn't able to reproduce the problem in jsfiddle.. http://fiddle.jshell.net/DqHxL/ .

How are you referencing the widgit? Is it with dijit.byId or document.getElementById. If you are using dijits you must use dijit.byId not getElement... Dojo creates shadow objects for everything

Related

Selenium Find Element by xpath using value as well

I am trying to check to see if buttons are present on a page. The number of buttons varies depending on the type of account that logs in. The code below returns true, so I know that the xpath is working.
Boolean WorkspacePresent = driver2.findElement(By.xpath("//body/div[2]/div[1]/div[1]/form[1]/section[1]/input[1]")).isEnabled();
However, I need to make sure that the value is also included, since this just checks how many buttons are there. If I wanted to check for a "Workspace" button, could I still use Find By Xpath?
To identify the Workspacebutton button use following xpath.Similar way you can identify other button.
driver2.findElement(By.xpath("//input[#name='Workspacebutton' and value='Workspace']"))

SQL Report initial toggle state

I have a report that contains a table of data this data is set to be intially collapsed using the initial toggle state property setting, however this does not happen the (sub-data) for want of abetter word still appears, and to make things even more confusing the icon that is placed at the side changes from the expected minus in expanded mode to a plus (which I would expect when the data is collapsed)
I have been trying to solve this for hours now but I cannot find a setting that will remedy the situation. I have tried selecting the row and edit group this allows me to set the rows to be exapnded by the relevant parent field, which I do set, but when applying the collapsed setting to the sub data, it is ignored.
Any help would be much appreciated thanks.
there seemed to be a strange error where if i edited the group directyly the group displayed the settings buit the page did nor solved by editing the page settings as well

Selenium IDE not recording Dijit Combo Values

I have an application which uses Dijit Combobox. What happens is, I click on the cell. It opens up a dropdown. This is getting properly recorded in the IDE. But, when I choose a value from the drop down, IDE is not recording that part.
Here is the firebug screenshot of the combo box that appears on clicking on the cell. As you can see it has two values cm2 and mat1. I need the IDE code to choose either of these values.
I tried something like
click - //div[#id='csi_table_Widget_5']/div[2]/table/tbody/tr/td[11] This works fine for opening the drop down.
click - //div[#id='widget_csi_widget_FilteringSelect_10_dropdown']/ul/li[4]
This does not work for choosing a value from the drop down.
Any help, please?
If you absolutely have to click the value, then I think you need to check the ID you are using. Based on the DOM you should be using //div[#id='csi_widget_FilteringSelect_10_dropdown']... instead of widget_csi_... I'm not sure a selector on widgetid would work in selenium.
Alternatively, if you know what value you will be entering into the combo, you could use selenium.type for all but the last character you need to enter, and then selenium.keyPress for the last one. This will fire dojo's change method and select the value in question, unless there is more than one matching the string provided.

Dojo Date text box and history.back() function

Here is the flow:-
page:-1 select Date from dojo DateTextBox and submit the page. There are couple of text fields along with date text box.
page2:- Review the values submitted in Page1. Have a option to go back using javascript History.back()
Problem:- when I go back other text boxes preserve their values but dojo DateTextField not able to prepopulate with the original value.
How I make the dojo component to remember its value when History.back() gets called?
I know History.back() function render the page from browser cache.
Thanks,
Manoj
The text boxes are remembering their values as a feature of the browser. The Dijit won't do this because the browser doesn't know anything about it. You would have to write custom code and remember the setting via a cookie and set the widget to the value of the cookie on page load (or on widget instantiation).

Masked Text Box removes preceeding zeros in date

I have a process which grabs the birthdate and from a data table and display them in a masked text box for viewing and editing
However when pushing the data into the textbox any preceding zeros get removed
For example 05/05/2005 would display as 55/20/05__
The masked Text box is set up as 00/00/0000
The line which assigns the code is:
MaskedTextBox.Text = Format(DataTable(0)("DOB"), “MM/dd/yyyy”).ToString
To date I have tried the following:
Delete and re-add the control
Copy masked textbox from another form
in the same program
Above Masked textbox grabs the same
information from the same database
table and is formatted exactly the
same and it works
Tried various different formats
including no format all with the same
result
Does anyone have any other suggestions?
I've been able to replicate the problem but currently there doesn't seem to be a solution. What you need is a binding navigator toolbar on the top of your form with your data bound masked text box with any mask (doesn't matter which one). When you run the form, initially the masked text box will accept the data just fine. However, if you click the "AddNewItem" button (the plus sign button) on your binding navigator toolbar, it will cause the masked text box to delete all preceding zeros when you try to enter a date. It seems all masks will do this. Rebuilding the form won't fix it, either. It happens every time you hit the "AddNewItem" button and then proceed to enter data into any formatted masked text box.
Now that I've found out exactly how to replicate the problem, hopefully someone more knowledgeable can come along to figure out how to circumvent this. It seems like it is a glitch within VB. Don't know if this constitutes as an actual "answer" but I have provided a clear path to finding a solution. I just don't have the know-how to get that far.
(Update: I discovered that it does this to all masks, not just "short date" masks)
I think I am going to have to put this in "Mysteries of the Unexplained " box.
At the advice of another developer I manually recreated the form, re-added all the controls and it now works fine (copy and pasting all the controls from one form to another caused the issue to come with it).
I really don't know how to even recreate the issue must be something in the forms design level code???
Anyway thanks for all the assistance from everyone.
Try converting the Datatable data to date and back:
MaskedTextBox.Text = Date.Parse(DataTable(0)("DOB")).ToString("MM/dd/yyyy")
My guess is that either the database is sending the date in a format you don't expect, you changed the control's Culture (under Behaivior properties), or that you changed the way your computer shows dates and thus changed its culture. However I try I can't replicate the problem with my culture settings.
I had the same problem with Masked a Text Box control that was added at runtime. I was just trying to add the date of the day to the control
Visual studio 2013
Dim Today As Date = Now.Date
tbox_ShipDate.Text = FormatDateTime(Today,DateFormat.ShortDate) 'Failed every time
Problem was solved by using
tbox_ShipDate.Text = Format(Today, "MM/dd/yyyy")
seemed to simple but all worked well