PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 22, 2022

[FIXED] How to defining id to a select tag in cakephp?

 April 22, 2022     cakephp-2.3     No comments   

Issue

My cakephp code for making a select tag is

<?php echo $this->Form->select('User.country_id',array($countries),null,array('id'=>'selection','empty'=>null,'label'=>false,'style'=>'width:231px'));?>

Here I defined id='selection' but when I inspect this dropdown box in browser it is showing id='UserCountryId'. How is that happening? My jquery and javascript is not working because of this.


Solution

if u need Id use cake php syntax

<?php
echo $this->Form->input('User.country_id', array(
    'type'=>'select, 
    'id'=>'selection',
    'style'=>'width:231px'
));
?>

your jquery and javascript will work try this



Answered By - Deepak
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing