Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6899057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:22:26+00:00 2026-05-27T07:22:26+00:00

I have a mobile website form that I want to add type attributes to

  • 0

I have a mobile website form that I want to add type attributes to the inputs so that there correct keyboard format will pop up.

However in cakephp setting the type as number a textarea is created instead of the input and the type is not set.

Setting type as text does work.

How do I overide this and have cakephp just keep it as a text input with type=number?

<?php echo $form->input('phone',array('type' => 'number')); ?>

Result:

  <textarea id="UserCardExpires" rows="6" cols="30" name="data[User][card_expires]"class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset"></textarea>

This is ok:

  <?php echo $form->input('postcode' ,array('type' => 'text')); ?> 

Result

  <input type="text" id="UserPostcode" name="data[User][postcode]" class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:22:26+00:00Added an answer on May 27, 2026 at 7:22 am

    On older versions of Cake, the Form helper won’t automagically interpret $options['type'] as the HTML5 input-element type attribute. You have to force it by using “type” as an option on an explicit text element.

    Use the following:

    $form->text( 'phone', array( 'type' => 'number' ) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing PHP/MySQL website that relies hugely on form POSTs for things
I have a mobile website and I want users with authorized devices to visit
I want to have a mobile-friendly website, in addition to a native app for
I have a jquery mobile website that has simple select. I have successfully tested
I am using JQuery mobile in asp.net web form website. I have the following
I have created a simple checkout form for use with a mobile website: <form
I have a mobile website that allows users to upload photos using the file
I have a HTML+CSS mobile website (not a real app) that is supposed to
I have a mobile website special for the blackberry. I would like to create
I have a reoccurring problem with the Android Browser. This is a mobile website

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.