forms

ColdFusion auto select option

What is the best way to automatically set a selected item for a select/option element on post-back? Here's the way we're currently doing it: <select id="grade" name="grade"> <option value="A"<cfif form.grade = 'A'> selected="selected"</cfif>>A</option> <option value="B"<cfif form.grade = 'B'> selected="selected"</cfif>>B</option> ...

Ruby Rails collection select is displaying blank "prompt" value?

I have a collection select like the following: <%= f.collection_select :region_id, Region.find(:all), :id, :name, { :prompt => 'Select a State/Province' }, :style => "width: 200px;" %> Sometimes the prompt from the :prompt option appears, but sometimes it does not. Does anyone know where I could begin to troubleshoot this? Maybe I h...

Safari: Submit form using xhrPost when the Enter key is pressed

I have bound a JavaScript function to the submit button of a form, causing the form to be submitted via an xhrPost request (using Dojo). However, when the user hits "Enter" in Safari, the form is submitted the usual way. Is there any way to prevent Safari from submitting the form when the Enter key is pressed? Can I somehow bind my Java...

Handling a (possibly paginated) list of items, like to toggle a value based on a single click?

Assuming of course we're working with HTML Forms and GET/POST data, backend language agnostic. Asker is most fluent with PHP and Python. Example: Tracking event attendance, there is an HTML page for the event administration that lists all available People. There is a column next to each name with a graphic/widget representing their at...

ASP.NET MVC - Caching Forms

More out of curiosity than anything. Do you think it'd be good practice to cache form pages? I've got a form that has a dropdown box that is populated from a rather hefty SQL call and takes a bit too long to load (from my shared hosting site). It's a simple form that when submitted just saves a bit of data to the database. I'm thinkin...

Get contents from radio button array in email

Hi, I have a sendemail.php set up for sending me information from a form. The way I have it set to send the information is with $_POST['variable name'] I cant figure out how to show the choice of a radio button array in the email that is sent to me. Thanks for any help. ...

Jquery: How do I set a hidden element to display when another element is in focus?

Hi! I'm trying to display contextual help alongside form fields, that is only visible when those fields are in focus or hovered over. I've tried using mere CSS, but the results seem very fragile and inconsistent. Here is my CSS: form .instruct { position: absolute; right: -220px; top: 10px; visibility: hidden; width: 200px; z-ind...

Japan Form Encryption Law

I've heard that Japan has a law that stipulates that all pages that contain forms with personal information must be SSL-encrypted. For example, under this law, a simple contact form with a "name" and "email address" fields would need to be encrypted. Is this true? Does anyone have a link to the details of this law (japanese language...

How to create a label inside an <input> element?

Hi! I would like to insert a descriptive text inside an input element that disappers when the user click on it. Example I know it is a very common trick, but I do not know how to do that.. What is the simplest/better solution? ...

Firefox and magically appearing character (Â) when unescaping an ®

I'm unescaping an ® (registration character) in firefox to be submitted in a form, since actually typing that character into Javascript causes the script to behave strangely. However, I must use the unescaped(..) version of the character since it is being submitted to the backend (where I have no control) and the output is a pdf file wh...

RESTful way to use form_for?

I am attempting to use form_for to implement a search form that works with a table-less Search model I created. The search form keeps triggering the 'index' action. I assume I should use 'new' to create the form and 'create' the process the search query. Looking at the log, my POST is getting changed into a GET. Here's my code: /searche...

Adding and removing tab pages at runtime in C#

I have a program that I want each person to have their own tab, each tab would be identical, however I would like to remove a tab if I need to. private void addPerson(string name) { TabPage tmp = new TabPage(); ListView tmpList = new ListView(); Button tmpButton = new Button(); this.SuspendLayout(); this.tabFrame.SuspendLayout...

Virtual PHP Form

I have a PHP file that spits out a form. I want to call this PHP file server-side, (currently using "include"), fill it in, and submit it. This is better so I don't have to meddle around with the actual form PHP, just deal with the presentation layer so the data gets understood by its own PHP file. Is this possible? The form "method" i...

PHP Query from a FORM

So I have a form that I post to a page and in the form I'm posting certain variables that I build one of my queries with and then call them on my page. How can I post data and also build a query and display the answer on one call? Maybe I'm not wording it right and I'm learning this stuff, but I just don't know. Should I post to an in...

How can I serve a web form and send the response via email securely?

Hi, I am trying to learn how to secure a web form. Take a simple example, a contact form, name, phone, email. I found this: Secure Email Techniques But I don't know if it is the correct way to go. It is not shared hosting, if it matters, and I have full access to everything. I am tied to IIS 6 and Windows 2000 at the moment, so I w...

jquery forms no navigate

I'm trying to make it so that a form submit doesn't cause the page to navigate and use ajaxSubmit to submit the content. however when I click the submit button, it still navigates to the page in the action attribute of the form. Heres the javascript: var options = { success: processLogin }; $('#loginform').submit(function() { $(...

Django equivalent of PHP's form value array/associative array

In PHP, I would do this to get name as an array. <input type"text" name="name[]" /> <input type"text" name="name[]" /> Or if I wanted to get name as an associative array: <input type"text" name="name[first]" /> <input type"text" name="name[last]" /> What is the Django equivalent for such things? ...

How to automatically export an Oracle Applications web form to PDF?

The idea is, upon data entry, automatically export an Oracle Applications (web) form to PDF, storing it in the database. Using XML Publisher, one can allow the user to export it on-demand, but I need to have the report/form PDF generated automatically. Answer A good solution is pretty much covered here. Basically, with a bit of OAF co...

How to remove x and y on submit in HTML form with Image type button ??

I have created a form in my application as follows: <form action="/search/" method="get"> <input id="search-box" name="search" type="text" size=30 title="Search" value="" /> <input id="search-submit" type="image" alt="Search" src="/images/search-button.gif" /> </form> But when I am submitting my form then URL is created as belo...

How can I create a form in Rails without having to use form_for and a model instance?

First of all, I'm a Rails newbie. I can hold my own in Ruby, but Rails is a whole different story for me. I like the development speed Rails offers me, but I can't seem to make peace with the existing documentation. For all of my forms so far, I used form_for, with an instance for the model I needed to create ( for example, submitting a...