create alert message..!

I have a stock table and column number , if the number of stocks is less than 100 then appears message " stock is less than 100 pcs " , a message that appears when we want to input the data ( create.php ) , how to make his syntax ? : /

Please help me

If you already have your models, then you can in create.php make something like:




$stock= Stock::model()->findByPk($stockId);

if($stock->number < 100) echo 'S[color=#1C2837][size=2]tock is less than 100 pcs[/size][/color][size=2]'[/size]

[size="2"]This will print you message only for one specific stock which ID you provided to [font="Courier New"]findByPk [/font]function.[/size]

[size=“2”]Please give me more details, and I will help you better :)[/size]

thankyou for your respon :))))




<div class="form">


<?php $form = $this->beginWidget(

	'booster.widgets.TbActiveForm',

	array(

		'id' => 'horizontalForm',

		'type' => 'horizontal',

	)

); ?>


	<p class="note">Fields with <span class="required">*</span> are required.</p>


	<?php echo $form->errorSummary($model); ?>


	<div class="row">

		<?php echo $form->textFieldGroup(

			$model,

			'jenis_blangko',

			array(

				'wrapperHtmlOptions' => array(

					'class' => 'col-sm-5',

				),

			)

		); ?>

	</div>


	<div class="row">

		<?php echo $form->textFieldGroup(

			$model,

			'jumlah_blangko',

			array(

				'wrapperHtmlOptions' => array(

					'class' => 'col-sm-5',

				),

			)

		); ?>

	</div>


	<div class="row">

		<?php echo $form->dropDownListGroup(

			$model,

			'satuan',

			array(

				'wrapperHtmlOptions' => array(

					'class' => 'col-sm-5',

				),

				'widgetOptions' => array(

					'data' => array('Set'=>'Set', 'Lembar'=>'Lembar'),

					'htmlOptions' => array(),

				)

			)

		); ?>

	</div>


	<div class="form-actions" style="margin-left: 192px;">

		<?php $this->widget(

			'booster.widgets.TbButton',

			array(

				'buttonType' => 'submit',

				'context' => 'primary',

				'label' => 'Save'

			)

		); ?>

		<?php $this->widget(

			'booster.widgets.TbButton',

			array('buttonType' => 'reset', 'label' => 'Reset')

		); ?>

	</div>


<?php $this->endWidget(); ?>


</div><!-- form -->



so I got a blangko table . and if the value of " jumlah_blangko " less than 100 ,then the warning message " jumlah_blangko less than 100 " . where I have to put the script in a file create.php ?

I want to alert this message appears when I would enter the new data as setFlash alerts …thank you for help me