ColdFusion 10 form variable functionality change relating to case of variables - forms

We're just looking at porting a legacy script to ColdFusion 10 and I believe I have come across a bug/change in functionality relating to the use of multiple form fields using the same name. In ColdFusion 9 these would have been appended to the relevant variable with commas, but in ColdFusion 10, if the case of the variables is different one field will overwrite the other.
The following test code:
<form action="index2.cfm" method="post">
<input type="hidden" name="test" value="1" />
<input type="hidden" name="TEST" value="0" />
<input type="submit" />
</form>
<cfdump var="#form#">
Produces on ColdFusion 9
TEST = 1,0
On ColdFusion 10:
TEST = 0
Has anyone else experienced this behaviour and knows whether it is a bug or intended functionality? I know the application shouldn't be using the same variable name in different cases, so will look at changing this, but just wondered if anyone had any more information on the issue.
Edit
I have submitted this bug to Adobe at https://bugbase.adobe.com/index.cfm?event=bug&id=3298179

#Russ
This feature is indeed just that a feature. I believe you've missed the point in the above post that specifying the same field name with different case no longer passes a list result.
One of the main things I and many have used this functionality for in the past is checkboxes. A group can have the same name so that your validation is easy yet different values so CF can process which ones have been ticked before form submission(obviously unticked items aren't passed into the list).

This bug appears to have been confirmed by Adobe in as Bug #3298179. It is reported as fixed in build 283412 and currently in the testing phase. I will update this answer with the relevent hotfix information once this has been released publicly.

That "feature" has been around since at least CFMX 6.1. I blogged about it back in '08: http://cfruss.blogspot.com/2008/01/passing-multiple-same-named-arguments.html

Related

Angular 2 formControlName inside a child component of formGroup

I am trying to build a wizard type form using Reactive Forms. Following is a snippet of my code
<form [formGroup]="pizzaForm" novalidate>
<wp-wizard navBarLocation="top">
<wp-wizard-step title="Dough">
<input type="text" id="dough" [formControlName]="dough">
wizard and wizard-step are working without forms.
When I implement them with Reactive Forms and run the application, I'm seeing errors like below.
Cannot find control with name: '[object Object]'
I'm assuming this is because dough formControlName is not immediate child of pizzaForm formGroup. Not sure though. If that is the cause, how do I fix this problem? I have few fields in each wizard steps and I think all the fields should still belong to the same form so I can track the form validity. Or may be I should have different forms for each wizard step ?
Please let me know if more information is required to understand the issue.
I mistakenly used [formControlName] instead of formControlName

Angularjs - date/time stamp

I am trying to figure out something using angularjs. Basically, today I decided to add a time/date stamp in my form. In other words, when someone is trying to post something, the time and date will appear.
Since I have a form with a live preview, I was trying to connect the time on the live preview. Afterwards, the time stamp would get published so that I could orderBy the comments from most recent to less recent.
I have two plunkers. For some reason, I couldn't get the code to properly work. Instead of showing up in the live preview as it should, it doesn't at all. It will on the form though. The first plunker has the bare minimum code, and is shown in the following link, while the second plunker is at the bottom of this message.
http://plnkr.co/edit/zgqXGGpoOw3UY90qT23H?p=catalogue
I will still display a portion of the code here, which is where my problem lies:
<blockquote ng-repeat="review in product.reviews | orderBy:'date'">
<b>Date: {{review.date}}</b>
</blockquote>
<form name="reviewForm" ng-controller="ReviewController as reviewCtrl" ng-submit="reviewForm.$valid && reviewCtrl.addReview(product)" novalidate>
<blockquote>
<b>Date: {{reviewCtrl.review.date}}</b>
<br/>
</blockquote>
<!-- DATE AND TIME -->
<!-- The other time formats are at the bottom of this page -->
<div ng-controller="timecontoller" ng-init="init();">
<div ng-model="reviewCtrl.review.date" ng-repeat="date in dates">
<b>Date: {{date.date1 | datetime}}</b>
</div>
</div>
</form>
While the second plunker has the whole viewable portion so that you can visually see the form (I removed certain elements though to make it easier to see). You'll have to click on the word "Review" first.
http://embed.plnkr.co/hHm1OPHk1uFD6YP2Roju/preview
If i followed your code correctly, it seems that you are trying to assign the review date with this line:
ng-model="reviewCtrl.review.date"
but its really not being given a data model or binding. If you truly wanted to transfer your timecontroller time update to the reviewController then I would recommend not using that as a controller, but instead refactor it as a service. Learn more here. Of course, you could also just open up your timeController scope and use a click event to transfer the data or something like that, but it doesn't seem like it should really be a controller to begin with.
Now i think I ended up changing your code more than it will really help you at all. But here is a quick implementation of how it can be done by making your timeController a service.
Plnkr
Just curious, why do you prefer this to $scope? It was giving me some trouble. Never really dealt with that before.

Zurb Foundation checkbox looking funny when publishing live

I have a simple Foundation checkbox according to these docs. Looks great locally:
However, when I publish to Heroku, my checkboxes all look like this, no code was changed:
Any ideas? Here's my code for the checkbox:
<label class="inline" for="attendance_shirt">
<input name="attendance[shirt]" type="hidden" value="0">
<input id="attendance_shirt" name="attendance[shirt]" style="display: none;" type="checkbox" value="1" class="hidden-field"><span class="custom checkbox checked"></span> Check here
</label>
Using the latest Foundation v4.1.6
UPDATE: Seems that things work nice locally because the content css property of the span element representing the checkbox is "\00d7". However, when I publish my Rails site to Heroku, that SCSS code in _custom-forms.scss turns into "\2A2F" for some reason.
Is this just a bug in the Foundation gem for Rails? Any workaround?
Looking at the Zurb docs, the custom checkbox appears to be using UTF-8 Multiplication Symbol × (\00d7 in a css content) instead of a regular X character. If you are using the same character, you may have to configure Heroku to use UTF-8.
Looking at this answer, this line might help you out:
heroku config:add LANG=en_US.UTF-8

Which is the more HTML semantically correct way to code a hidden html field with a numeric value that the user is not expected to manipulate with

In my examples the value will always be an integer. The user is not expected to change the value of the field.
<input type="hidden" value="14" name="user_id" readonly/>
<input type="number" value="14" name="user_id" class="hidden" readonly/>
The only way to make a field hidden in HTML is to use type="hidden". You may have been misled by the HTML5 feature type="number". It’s not really comparable to typed variables in programming or types of fields in data formats. Instead, it is meant for creating a specialized user interface suitable for input of numeric data (such as a spinbox, possibly still allowing typing of numbers). This would be pointless, as you do not expect or even allow user input here.
By the book, the correct answer is <input type="hidden" etc... /> because the User Agent already have the rules on how to interact with such fields.
CSS or not, your field won't show up and it's better for accessibility etc. There's no way a user can interact with a hidden field (except javascript or editing the code locally). I would still validate the value.
I'm genuinely of the opinion that it doesn't matter in the slightest since, with JavaScript, or CSS, they're both equally accessible to (relatively) knowledgeable users. However, and as a personal preference, I'd always use type="hidden", since that seems to be what it was created for.
I would, though, recommend that you pick whichever you prefer and then use that approach consistently, but this is, really, a question of pure personal preference.

HTML Form text input suggestions box

I am attempting to modify one of my text input boxes in a form that I have. I would like suggestions to pop up as the user types. Basically, I would like to emulate the "Tags" box that is on the ask question pages here on Stack Overflow, but with different data as the suggestions obviously. How would I go about doing this?
For context, this is for a club at a college, and I am trying to allow members to type in their majors and as they type have a suggestions come up.
This snippet from Cena Mayo did just what I was looking for:
<input id="color" list="suggestions">
<datalist id="suggestions">
<option value="Black">
<option value="Red">
<option value="Green">
<option value="Blue">
<option value="White">
</datalist>
Documentation
jQuery has an autocomplete plugin that you could use.
It depends on what kind of language/platform/etc. you are using as well. I am a primarily .NET developer and I've used the following:
SQL Server for storing data
Web Forms or MVC for the web app
An ashx handler to retrieve and format the suggestions
jQuery plugin above to render the results returned from the ashx underneath an input box
Well if you want to get information from a database on commonly used or already created elements you'll need more than just html. If you just want the form to suggest things people have already input in their own browsing sessions the form will do that automatically.
What I can point you towards is this guys post. He outlines and gives the basic code to get you started on the path for auto suggestion in forms He even gives you the files to get you going, but you'll have to do some modification work.
Also included later in the post somebody adds this to go into the ajax_framework file.
`function clearsuggest() {
e = document.getElementById('results');
e.style.display="none";
}
`
In search.php:
onClick="fill();clearsuggest();return false;"
That section of code will clear the suggestions upon click of a suggestion. Hope this helps and good luck.