Yii Framework Forum: CHtml::activeTextField - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CHtml::activeTextField Rate Topic: -----

#1 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 07 June 2010 - 09:07 AM

Can i put a where condition in an CHtml::activeTextField??
I need the value of a textfield is equal to another previously inserted
-1

#2 User is offline   tydeas_dr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 158
  • Joined: 16-April 10
  • Location:Greece

Posted 07 June 2010 - 09:18 AM

The description you give does not help.
inserted ???
You have inserted the value in the database or there is an other textfield above?
Follow me on twitter @dmtrsslvdr
Check my *new* blog @ tumblr
0

#3 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 07 June 2010 - 09:48 AM

View Posttydeas_dr, on 07 June 2010 - 09:18 AM, said:

The description you give does not help.
inserted ???
You have inserted the value in the database or there is an other textfield above?


So I'll explain... a have a field in a db table which is foreign key linked to another field in another table ... I should connect these two fields and I want to add a where clause that put the two fields are the same .. .
0

#4 User is offline   tydeas_dr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 158
  • Joined: 16-April 10
  • Location:Greece

Posted 07 June 2010 - 11:54 AM

Why don't you use a dropdownlist instead of a second textfield? Giving the user the ability to select only from the field that exist?
Follow me on twitter @dmtrsslvdr
Check my *new* blog @ tumblr
0

#5 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 08 June 2010 - 01:10 AM

The ideas of tydeas_dr is good.

If you want to validate a text field in order to allow only data that there are in a table you can use a CExistValidator.

You can also use a dropDownList like that:

CHtml::activeDropDownList($model,$attribute,
	CHtml::listData(foreign_table::model()->findAll(),
	'primary_key_field','recordDescription'),
	$htmlOption);

1

#6 User is offline   kitty10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 139
  • Joined: 13-April 10

Posted 08 June 2010 - 03:33 AM

View Postzaccaria, on 08 June 2010 - 01:10 AM, said:

The ideas of tydeas_dr is good.

If you want to validate a text field in order to allow only data that there are in a table you can use a CExistValidator.

You can also use a dropDownList like that:

CHtml::activeDropDownList($model,$attribute,
	CHtml::listData(foreign_table::model()->findAll(),
	'primary_key_field','recordDescription'),
	$htmlOption);



Maybe I have not explained well .. I need to pass the value of a field is a ANAGRA_ID is a code .. .. and then the field should also make it hidden.
I created a single form with three different models there is a field ANAGRA_ANAGRA_ID that is not nullable foreign key in another table that has a field ANAGRA_ID.Now I need these two fields have the same value and that is not visible on the form...can you help me???
-1

#7 User is offline   amitkumarviet 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 07-July 13

Posted 27 July 2013 - 12:38 AM

how to put condition in text field?
0

#8 User is offline   Abhishek Shah 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 20-July 12
  • Location:New Jersey,USA

Posted 27 July 2013 - 04:18 AM

You can do,with compare rule in model.compare your field with other,in your model.It will be like logic of confirm password.
array('retype_pass', 'compare','compareAttribute'=>'password'),
Feel free to ask for help,
Abhishek.
Freelancer.
Yii Basic Gii With Export Pdf Excel
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users