Rails: How "email_field" differs from "text_field"? - ruby-on-rails

I understand that text_field creates an input field of type text, while email_field creates an input field of type email.
But, what is the difference between these two input types ?
Say I have a client model while a client has an email. Should I use email_field here ?

The email field is the new html 5 input which right now behaves the same on most of the machines with the exception of a few mobile devices such as the iphone where it switches to a different keyboard.
You can find more about it by googling html5 email field.
It's just a touch of finesse which some users will appreciate.

Related

Place Autocomplete in iOS (swift) on Signup (address) form

I am a signup form which has bunch of text fields like name, phone, address 1st line, city, state etc.
Can I use googles's Place Autocomplete on this form in such a way that when I start typing address 1st line in one of the fields it suggests/auto completes and fills the city and state
1st question, is it possible, if yes are there any examples or tutorials?
There are examples out there but they use autocomplete UI, I want to be able to use my own edit text fields.
So Yes I was able to do exactly what I wanted.
I had two dependencies for this.
1. AutoComplete Text Field
2. Google's Place AutoComplete

validation for email and mobile no in single inputbox using angularjs

How can I validate emailid and mobile no both in a single input box in AngulaJS?
I'm trying to validate emaild and mobile no in same input box. it is working fine seperately, but for both emaild and mobile it doesn't work.
If you wish to verify the input using AngularJS (not the safest way to do it if it's the only check, making a second check in PHP/back-end/server side is recommanded).
You can use regular expression to filter the email and the phone number. You might want to check out ng-pattern
AngularJS Official documentation page
Emails and AngularJS: https://docs.angularjs.org/api/ng/input/input%5Bemail%5D
Example: https://jsfiddle.net/txtuz2xn/4/
Phone number will vary from a country to another. Up to you to see how you want your regex to go.
If you want to have 1 input that checks either the phone or the email you could set up $scope.regex1 = ... and $scope.regex2 = ... and check regex2 if regex1 fails.

Testing email markup against myself not working

I've used this schema example and sent myself an email using the Email Markup App Script.
The mail is recieved but no Event card is shown. I've also validated it with the Google Markup Validator, and I'm not missing any required field. What am I doing wrong?
PD: Only "Action" markup worked for me.
#whitenoisedb I see that you've tried sending the lodgingreservation schema to yourself. If you're copying and pasting the example without modifying the checkinDate and checkoutDate attributes, your card will not generate until 2017.
"checkinDate": "2017-04-11T16:00:00-08:00",
"checkoutDate": "2017-04-13T11:00:00-08:00"
Use a current checkinDate (ex. 2015-12-15T16:00:00-08:00) instead.
If the dates are coming up soon and it is still not showing, there is a chance that this type of Google cards are not supported in your country

QuickFIXJ setting SendingTime in messages

I have a FIX application which is connected to several price providers. It distributes the data it received to our inner applications. When it is sending the received messages from the price providers to the target applications, it modifies the SendingTime(52) field in FIX header which is not acceptable. The inner applications want to get the original SendingTime value. How can I say to the QuickFIXJ engine not to assign a timestamp value?
Thanks
What you desire... is kind of wrong. Header fields are to be used by the engine, and for application data (which is what this relayed SendingTime kind of is on the second leg). Your inner FIX connection should not be clobbering the SendingTime field. You might need the actual SendingTime field if you are diagnosing problems with your inner connection!
What you really need is a second SendingTime field. You should edit the DD of your inner FIX applications to add another field for which to store the old SendingTime value. Tell your inner target apps to refer to that field.
NOTE: You probably don't want to use OrigSendingTime (tag 122) for this. That field has a very specific usage already. Name your new field something else.
FIX Market Data messages (35=W, 35=X) usually have MDEntryDate (#272) and MDEntryTime (#273) fields to represent the timestamp of the market data price. If it is related to Quote/trade messages, you may have the TransactTime (#60) field.
It worth keep the SendingTime (#52) and MDEntryDate MDEntryTime/TransactTime separated, you can compare the difference between the price's timestamp and the counter party's infra structure timestamp (sending time). It would help to identify delay between the systems.
If the message you are handling does not have any Application DateTime field, you can pick one. which its value would be the SendingTime for the original FIX message you've received.
You can either select and use an existent field (http://www.onixs.biz/fix-dictionary/4.4/fields_by_name.html) or you can create your own user defined field.
Once you decided to create your own field, it is a good practice to check the oficial Global Technical Committee user defined fields list at https://www.fixtrading.org/standards/user-defined-fields/ and using the user defined fields range.
Sites
Fields by message: https://www.onixs.biz/fix-dictionary.html
User defined fields: https://www.fixtrading.org/standards/user-defined-fields/

Can someone explain Rails behavior for multiple fields with identical names and ids?

I needed to create a input mask for a jQuery datepicker in my Rails app, where the first form field uses m/d/yy format and the datepicker populates a hidden input with the proper database format.
I was using SimpleForm, and so I extended my own input so that the input is preceded by the mask.
I got everything set up and when checking out the browser, it all just worked well before I thought I would be done.
The form ends up with two inputs for the same attribute, each with the same id and name. I never thought this would work. Checking the development log I only see one date getting submitted, the second of the two which is the one that has the proper format for the database.
Is this all okay? Should I take some extra steps even though this appears to work fine, and more importantly, can someone explain what's going on under the hood that results in this behavior?
Thanks!!
Rails uses the Hash params to store fields submitted. When you declare two or more inputs using the same name, it happens the same as if you do something like
h=Hash.new
h[:name]="foo"
h[:name]="bar"
Result is bar because the foo was overwritten. So the "winner" is always the field value which the browser last appended to postdata.
But if I where you, I would not rely on the browser that the second field gets appended at last.

Resources