forms

Django: Form validation for accepting strings with first letter in CAPS

江枫思渺然 提交于 2021-01-28 08:13:44
问题 I have a model form defined in my application, and in one of my form fields, I want the users to enter their inputs, but with the first letter of their inputs in capital. If that's not the case, the application should throw an error and prompt the user to re-enter that particular form entry. Is there an in-built Django form validator for implementing such a restriction? PS: I am aware of the capitalize() method provided by ModelForm which stores the form field in database with first letter

How can I prevent \ from being added from the form input?

微笑、不失礼 提交于 2021-01-28 08:08:31
问题 The html form accepts textarea input, and I am using $_POST value to put the input value to textarea when I am displaying it. For example. <html> <?php if($_POST['input'){ <form method="post" action="<?=$PHP_SELF?>"> <textarea name="input" cols="60" rows="20"><?=$_POST['input']?></textarea> <input type="submit" value="Test it"> </form> <?php } else { ?> Please copy in a text of your choice <br /><br /> <form method="post" action="<?=$PHP_SELF?>"> <textarea name="input" cols="60" rows="20"><

Avoid CSRF token in URLS

半腔热情 提交于 2021-01-28 08:05:22
问题 In the browser I can see CSRF token in URL which I want to avoid. http://localhost:8080/......./new?someval=val&CSRFToken=1975f761-fb40-4146-ad02-29ba9d5b3cdd The root cause is we are using FORM tag with http method GET. This is being used as some hidden parameters we want to pass to controller for some processing. How to avoid CSRF token in URL. Because I dont want to remove form as it is already tested and will be a testing impact. 回答1: I had the same issue and I changed the submission's

STOP Google Autofill/AutoComplete from ruining my form, Disable autofill on form

与世无争的帅哥 提交于 2021-01-28 08:00:59
问题 I have a form with an input field: <input id="postalCode" placeholder="Postal Code* (A0A 0A0)" autocomplete="off"> I was using my own custom autocomplete here which google autofill COVERS and ruins the validation and user experience in my form. I have tried changing the id to something random id="ASDf" and still google infers the field type by the validation or placeholder. I have tried the autocomplete="off" and "false". Neither do anything. On this page: https://www.canadapost.ca/cpotools

Bootstrap success alert upon form submition via javascript [closed]

不打扰是莪最后的温柔 提交于 2021-01-28 07:40:12
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Improve this question I've been searching the internet for hours to try to understand how to make a dismissible green alert slide down (non-modal) when a user submits a form. I'm thinking it has something to do with form validation but not sure. Please help. The code isn't working

Symfony ValidatorComponent > AnnotationMapping in FormComponent

喜欢而已 提交于 2021-01-28 07:26:46
问题 Im working on a project where I'm using some Symfony Components. My problem is how to make the Form Component's validation of Forms use AnnotationMapping to find the constraints. SetUp: global $loader; //composer - autoload AnnotationRegistry::registerLoader([$loader, 'loadClass']); $validator = Validation::createValidatorBuilder() ->enableAnnotationMapping() ->getValidator(); $formFactory = Forms::createFormFactoryBuilder() [...] ->addExtension(new ValidatorExtension($validator)) -

Perl: Perl6::Form format

末鹿安然 提交于 2021-01-28 07:03:59
问题 I have file something like this, SR Name Rollno Class 1 Sanjay 01 B 2 Rahul_Kumar_Khanna 09 A Now I need to add "|" between each. So it should look like SR | Name |Rollno | Class| 1 | Sanjay |01 | B | 2 | Rahul_Kumar_Khanna|09 | A | I am using Perl6::form my $text; foreach my $line (@arr) { my ($SR, $Name, $Rollno, $Class) = split (" ", $line); my $len = length $Name; $text = form '| {||||||||} | {||||||||} | {||||||||} | {||||||||}|', $SR, $Name, $Rollno, $Class; print $text; } Here till now

Dynamic form not submitting (jQuery)

夙愿已清 提交于 2021-01-28 06:43:19
问题 I'm creating a simple task manager app with PHP, MySQL, & jQuery. I'm adding a feature that will allow users to add a task by clicking a "new task" button, typing into a text field and hitting enter. This is the jQuery I have: function add_task() { // Add the "add new task" button $("<span class='add-new'>Add new item</span>").appendTo(".sub-phase"); // String for the input form var task_form = '<form class="add-new-task" autocomplete="off"><input type="text" name="new-task" placeholder="Add

Send email without server using google script: unable to open file error

▼魔方 西西 提交于 2021-01-28 06:29:22
问题 I want to send an email to a location target@example.com using google script . I am following this - https://github.com/dwyl/html-form-send-email-via-google-script-without-server to setup the whole functionality in my website. There is an html form in my website and I want to send email whenever someone clicks on the submit button on my site here is the html of the form - <div id="content"> <h1>Contact Us</h1> <h4>Fill out the form below and a representative will contact you shortly.</h4>

what is the alternative of FormData in IOS?

不羁岁月 提交于 2021-01-28 06:25:00
问题 I'm using xmlHTTPRequest (and also $.ajax) to send a form(that contain some text inputs and multi-file input) without refreshing the page. I'm using FormData to send the form successfully on PC (Chrome). When I run the page in my IPAD (IOS), it didn't work. After trying to know where the error was, it seemed that FormData not supported in it. Is there any alternative for it in my case ? var formDataH = new FormData($('#FeedbackForm')[0]); var xhttp = new XMLHttpRequest(); xhttp