I need to disable future dates for my end date in joomla.
<?php echo JHTML::calendar('','enddate','enddate','%Y-%m-%d'); ?>
Any idea...
"Need to hide future dates"
It is not possible using the Calendar field.
http://docs.joomla.org/Calendar_form_field_type
Even if it was possible, users could easily manually type in a date in the future in the field as the calendar pop-up simply fills out a text field that is then submitted with the rest of the form. Even if that was locked people could easily hack it using Firebug or similar.
I think the correct implementation is to validate the selected date after entering and throw an error if it is in the future and then do something similar in PHP to avoid users manipulating the submitted data.
Related
I was trying to grab a website calendar from UiPath. But when I use the Find OCR Text Position or Click OCR text activity in the UiPath Software, it will not give me the exact date that I want to select.
I want to do one thing only: I need to determine today's date, select the date, and press OK.
I figured out how to calculate today's date:
But now I only have to do, is selecting numbers, Please help me to figure this out. Thanks in advance.
Since we don't know much about the front-end framework you're planning to use, here's a generic approach using a relative selector. Note that I hard-coded the day (15), and I didn't check whether the correct month or year is displayed, but this should at least get you started.
My approach uses a simple click activity with the variable day being part of the selector. There's another click activity associated with opening the picker in the first place, but as said - this is just related to the front-end framework.
It looks like DateTime_Today is a DateTime type variable in your screenshot, which has a very useful ToString method see documentation on it here: https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tostring?view=netframework-4.7.2 which will allow you to extract the number that you are looking for.
You would need to create a string variable and assign the value to DateTime_Today.ToString("dd") to get only the day of the month.
The issue with this approach, however, is then creating the image for the OCR to look for in the calendar. I think a more reliable way of approaching this issue would be to determine what date is selected by default when clicked and then sending some combination of hotkeys such as tab and the directional keys to get to the date which is required for the automation. A get text or get attribute activity might also help determine what date is currently selected, so you would then know how many boxes will need to be traversed to get the required selection.
If you are still having issues please provide a link to the page which you are trying to automate as well as some (sanitized) code snippets containing what you have already tried and we will be able to assist you further. Cheers!
We are using form designer of servicenow to change elements on a form.
The table used to create the form is extended by the task table and contains a workflow with approvals and various stages.
When we try to change something within form designer, it does not matter what it is, renaming a field from summary to summarys for instance and clicking save.
The action gives this error:
JSONObject["caption"] not found
Only some forms are affected by this issue, for instance incident forms, change forms all open and can be changed and saved.
I have a feeling that this error is related to a known issue but i just wondered if anyone on here has seen it.
NB: It is not possible to share my JSON response because it's all done behind the scenes by servicenow. I am in a form design view and I am simply clicking save on a form change
Thank you for your time
This has now been resolved.
Turned out a title on a form header had more than 40 characters and this was causing the error on form save.
Max limit on a title
I have a question on the subject of composite attributes that I would be grateful if you could help me with.
I posted this before on other question blogs but got no response I am satisfied with.
I am writing JavaScript that will update the fields (i.e. address1_line1, address1_line2, address1_line3, address1_city, address1_stateorprovince, address1_postalcode, address1_country) in the composite (address1_composite). When the fields are updated the composite does not seem to update. I have to open the composite and close it again. Is there a way of doing this automatically in JavaScript?
I have tried the following ideas:
Idea 1:
Xrm.Page.data.entity.save();
This is recomended at http://community.dynamics.com/crm/b/magnetismsolutionscrmblog/archive/2013/10/22/working-with-dynamics-crm-2013-composite-fields-fly-out-menu.aspx
This is not any good as my customers want to view the composite before saving the page. Also I would not want to save the page for my customers as they do not want this. They would like to decide when to do this themselves.
Idea 2:
Xrm.Page.data.refresh();
This is not really what I wanted as I do not want to refresh the whole page. I just want to refresh the composite. Also it bring up a popup that warns you about not having saved the page which will be annoying for my customers.
Idea 3:
Writing the address from the address lines to the composite.
This feels like a nasty hack.
There is probably more than one way of doing this. I used the function
Xrm.Page.getAttribute("address1_composite")._attribute.setValueForCompositeField();
I do not like this for the following reasons:
This is a hack as it is not using the system functionality of the done button to write the data.
You do not get the system formatting you get with the done button although this will get done when the form is saved so it is not so bad.
In the future if customers are allowed to add their own composite fields it could cause problems as the field names could be different.
It requires me to write extra code for each form that has a composite which has fields with different schema names. E.g. I have to write different code for forms with ShipTo and BillTo addresses as the code for the account form will not work.
Another idea was to set the focus to the composite field after a change has been made to any of the fields inside the composite.
Xrm.Page.data.entity.attributes.get("address1_composite").controls.get(0).setFocus();
This is the best idea so for but it is far from perfect. This forces the user to press the done button and hence the fields will be written. I was hoping for something more automated.
My Question:
What would be great is if there was a way to click the composite done button in JavaScript. This would give me the formatting of the done button and the automation I need.
Update - 14/04/2014
Since posting this question I have been in contact with Microsoft and they say there is no supported way of clicking the done button via a program.
If the field is locked down CRM JavaScript does not send the data back to the server for updating. Another approach would be:
perform the update using JavaScript (so the user sees the change); and
use a server side plugin on the Update event so the value is persisted.
I can use: #Html.HiddenFor to hide a field on a form, however, you can still see the value of the hidden field using "view source".
Is there a way in MVC3 to hide the hidden field in view source as well - I want to completely hide the primary key from the user, but still pass it from the view to the controller via the model, when posting the form.
Any code snippet or link to an example is appreciated.
Thanks
Well, put simple no. If you intend to send the key through the form, there is no way to hide the data from the source.
As you don't mention what primary key or what kind of form data you are posting, it's hard to give any other suggestions. If it is the primary key of the user, you can of course use the login session, instead of sending the key through the form, but in any other case, I'm afraid you have to reveal the primary key through the source.
You cannot hide a field from a source.
But in certain situations you can try to do something else like not passing the ID to the view. Keep it on controller side, and use it on the form submit. Of course you need to be carefull with that but it's doable with TempData or ViewData . Here's a hint http://haacked.com/archive/2007/12/21/asp.net-mvc-helpers-for-repopulating-a-form.aspx
If you need to keep information across multiple requests, then utilize the TempData collection on the server side as it's backed by session but designed precisely to keep information for short durations. Alternatively, if you must push the data to the client via hidden or other html with zero height, then encrypt it using symmetric encryption or at least base64 encoding ( very poor man approach to keep it away from curious eyes).
I am using the DatePicker control from WP7 control toolkit in my app for the user to enter in an expiration date. One of the scenarios is that the record doesn't have an expiration date. How can I use the control such that by default, there is no date specified in the control and the user can select a different date?
Also, if I user sets an expiration date but letter wants to clear it, I need to enable that as well.
Pratik
For the default value to be blank, in the XAML
<toolkit:DatePicker x:Name="dpComp" Value="" Width="220" Hold="dpComp_Hold"/>
If you would like to allow a user to clear the value of datepicker then you can do this in the code
private void dpComp_Hold(object sender, System.Windows.Input.GestureEventArgs e)
{
//Let user to clear the value.
((DatePicker)sender).Value = null;
The DatePicker control doesn't support the concept of no date selected.
The DatePicker will default to the current date if none is selected on the assumption that this will be the most useful to the user. Forcing the user to select values which you could provide a likely default value for means you're making the user do more work than they should have to and you are therefore wasting their time.
If no expiry date is valid, leave this field blank by default.
With regard to clearing an entered date, add a separate option to do this. Either a button or menu option.
I would look at the .api for customization of the DatePicker Control: http://windowsphonegeek.com/articles/wp7-datepicker-and-timepicker-in-depth--api-and-customization
I don't know of anyway to do what you are looking for (however I might want to know in the future). The link above seems to suggest you can create your own custom page and you can then maybe work out a way to return what you are looking for.