I have a textbox that I've attached the datepicker to. If the user enters the date via the datepicker all is well but they also have the ability to go in and enter a bad date directly into the textbox. i.e. 1/55/1995
Can the text box be disabled so only the calendar can be used?
How are people preventing this?
Looks like what you need is to just disable the field or make it readonly. Check out this answer How can I disable all keyboard keys?
I would say readonly is the better option because it still allows the value to be retrieved when it is posted back; don't think disabled fields get picked up.
You can validate the input text, if entered manually to the textbox.
Have a look at the url below,
http://keith-wood.name/uiDatepickerValidation.html
Hope this helps.
Cheers
Related
im using IPS, and i wish to add predefine autofill textarea in the ckeditor text field.
so when a page with ckeditor feild is loading, it will have spesific words in it.
and is the area is requaird and the user do not fill it, the system will act as the user have filed it and will save the form with the autofill of the textarea.
i have tryd to locate the textarea file location without success.
i just need the textarea file location so i can add the code i need.
for exsample:
<textarea>
my predefine autofill text
</textarea>
thank you.
i have figurd it out.
the way to add autofill texterea in all ckeditor4 location is here:
in the html editor of the IPS
core->global->forms->editorRaw
at this line of code:
<textarea name="{$name}" data-role='contentEditor' class="ipsHide" tabindex='1'>{$value|doubleencode} add data here</textarea>
hope it will help someone.
I have about 20 forms, each with 15-20 textbox inputs each.
Once the user submits the form, all their values need to be confirmed, this is done by replacing each textbox with a label control that shows the entered value.
The user may click on a back button to edit the data, in which case the textboxes re-appear, or they can confirm their data submission.
What would be the best way to handle this in MVC?
Thanks
I would recommend having different views for editing and showing data. This could be useful if you would like to omit or add some extra of the fields, keeping your view logic simple. You could store the form data in the database with some flag indicating that it is not confirmed yet. After confirmation you would only change the flag of the record. Another option is to store form data in tempData or Session and save it after confirmation.
The quickest way would probably be to have both on the page and bound to the same Model properties but wrap them in some simple render logic. an example off the top of my head in razor could be something like
#if (is in edit state){
<field markup>
#}
else{#
<label markup>
#}
Its been a while since I've worked on an MVC app but that's how i would have done it back then i think.
I have 2 DateBox (from & to). What I want to do is whenever I click on the "from" DateBox it will always clear the "to" DateBox.
I'm looking at the doclear method and I'm not sure if it is the right one or even know how to use it.
Just to be clear I'm using this.
Any help would be appreciated. Thanks!
In my testing setting the value of the box to an empty string ('') works.
Assuming id of fromDate and toDateon the two boxes the following code should do the trick:
$('#fromDate').click(function(){
$('#toDate').val('');
}
I'm using ExpressionEngine and SafeCracker along with Ajax (plugin: jquery.form.js - http://jquery.malsup.com/form/).
Best I can tell, SafeCracker will only allow for updating a single entry at a time. However, the UI / UX necessitates that a list be displayed. I've proof of concept'ed an entry by entry on-demand form. That is, click a particular edit link next to each entry and a snippet of jquery creates a form along with displaying a submit button. Click submit and that single entry updates. The inputs don't exist until the Update link is clicked
What I would prefer to do, if possible, is to create the non-form and form versions of each entry as the page is renbered and use some sort of toggle to display one or the other. Again, doable. Then, when I click the Edit link I'd add the necessary attributes to the input so that entry's form elements will be read but the other (display: none) elements for the other entries will be ignored. I'm thinking (out loud) that if I add the attr("name", some-value) that would work. That is, an input with no name will be ignored.
Yes, I can test this and I will. However, even if it works I'm not sure if it's a best practice and/or there's a more ideal way of accomplishing my ends. I'm here looking for validation and/or additional expertise and input.
Thanks in advance.
Just set disabled property to inputs and they will excluded from Form submission, whatever input fields are hidden or visible. Different jQuery methods, like submit() and serialize() follow specification of HTML 4 and exclude all disabled controls of a forms. So one way is to set
$('your_input').prop('disabled', true);
or ,
$('your_input').attr('disabled', 'disabled');
Check following link:
http://www.w3.org/TR/html401/interact/forms.html#successful-controls
Also, you may use a general button instead of a submit, as result you can handle click event on it and within that event you can make exclusion, validation, manipulation on values and what ever you like.
You can put a disabled attribute on them server side or set the property via jQuery:
$(".hidden input").prop("disabled", true);
I've got an MVC app that gives the user textarea's to update some description fields. It's strongly-typed to a table object, and the fields are wrapped in a form with a Submit button.
Occaisionally they don't want any data in a field, but when they delete the text and try to save, the blanked-out field comes back with its original text (i.e. the table object passed to the Save action contains other edits, but attempts to blank out fields result in the original text staying in the field).
I'm assuming this is LINQ trying to determine which fields have been edited, but how do you tell it that it's blank on purpose?
UPDATE: It appears this may be a problem with the TinyMCE jQuery plugin. It adds rich-text functionality to textarea controls. If I turn it off, I can remove text with no problems.
UPDATE 2: It seems to be some kind of javascript bug or something. If I put another dummy field after the problem fields, they work. If I move them to another place in my code, they work. They just don't want to work where they are. Very peculiar.
I'm pretty sure that TinyMCE, by default, puts in <p></p> when the control is emptied.
So if you are checking for "" then you may be disapointed.
This initially caused me some issues but never with saving. I was checking if the field was "" and then doing something else. Once I realised that "" was never going to happen, I adapted my validation accordingly.
I just check that on a recent project using TinyMCE editor, but it indeed send "" for an empty input, and during the implementation we had no issues with that.
alt text http://diarioplus.com/files/pictures/tiny.PNG
The body property is the one with a tinyMCE editor on the client side.
I really think it will be something with the modelBinder or the way you set the values back to the model.