Guest User

Untitled

a guest
Aug 14th, 2014
295
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. parent model: $model=> Evaluation
  2. attributes:
  3. - ClassRegistrationIDFK <-foreign key for Classregistration
  4. - ....
  5. -......
  6. //////////////////////////////////////////////////////////////////////////
  7.  
  8. Classregistration (a model, in this case is model2, isn't the child model)
  9. attributes:
  10. - StartDate
  11. - CourseIDFK
  12. - ClassTypeIDFK
  13. -.......
  14. /////////////////////////////////////////////////////////////////////////
  15. ‪#‎Studentregistration_ClassRegistrationIDFK is for the foreignkey
  16. #‎class_text is for the value of attribute (it's the main PROBLEM, I can't load it in CREATE :( )
  17. //////////////////////////////////////////////////////////
  18. _form:
  19. <div class="row">
  20. <?php echo $form->labelEx($model,'ClassRegistrationIDFK'); ?>
  21. <?php echo $form->hiddenField($model,'ClassRegistrationIDFK');
  22. echo GxHtml::textField('class_text','',array('size'=>60));
  23. echo GxHtml::ajaxLink(' <code>+</code> Choose Class',Yii::app()->createUrl('evaluation/selectClass'),
  24. array('update'=>'‪#‎Evaluation_ClassRegistrationIDFK‬'),array("id"=>'ClassRegistrationIDFK'));
  25. ?>
  26.  
  27. <div id="Evaluation_ClassRegistrationIDFK" style="visibility: hidden;"></div>
  28.  
  29. //////////////////////////////////////////////////////////////////////////////////////////////////
  30. //////////////////////////////////////////////////////////////////////////////////////////////////
  31. this is in TbGrid->modal in CDialog: // wanna load attribute from related model
  32. array(
  33. 'header'=>'Choose',
  34. 'type'=>'raw',
  35. 'value'=>'CHtml::link("<code>+</code>","",array(
  36. "onClick"=>CHtml::ajax(array(
  37. "url"=>Yii::app()->createUrl("Student_registration/selectDataClass",array("id"=>$data->ClassRegistrationID)),
  38. "dataType"=>"json",
  39. "success"=>"function(data){
  40. $(\"‪#‎Studentregistration_ClassRegistrationIDFK‬\").val(data.satu);
  41. $(\"‪#‎class_text‬\").val(data.dua);
  42. // data.satu is from parent controller $satu=$model2->primaryKey;
  43. // data.dua is from parent controller $dua=$model2->StartDate.' - '.$model2->CourseIDFK.' -'.$model2->ClassTypeIDFK
  44. $(\"‪#‎bandsdialog4‬\").dialog(\"close\");
  45. }")
  46. ),"id"=>"child".$data->primaryKey,"style"=>"cursor:pointer;"))',
  47. ),
  48. ),
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×