- $eventId = &$form->add('text', 'event_name', ts('Event Name'));
- $eventType = &$form->add('text', 'event_type', ts('Event Type'));
- $participantFee = &$form->add('text', 'participant_fee_level', ts('Fee Level'));
-
- //elements for assigning value operation
- $eventNameId = &$form->add('hidden', 'event_id', '', array('id' => 'event_id'));
- $eventTypeId = &$form->add('hidden', 'event_type_id', '', array('id' => 'event_type_id'));
- $participantFeeId = &$form->add('hidden', 'participant_fee_id', '', array('id' => 'participant_fee_id'));
+ $eventId = $form->addEntityRef('event_id', ts('Event Name'), array(
+ 'entity' => 'event',
+ 'placeholder' => ts('- any -'),
+ 'select' => array('minimumInputLength' => 0),
+ )
+ );
+ $eventType = $form->addEntityRef('event_type_id', ts('Event Type'), array(
+ 'entity' => 'option_value',
+ 'placeholder' => ts('- any -'),
+ 'select' => array('minimumInputLength' => 0),
+ 'api' => array(
+ 'params' => array('option_group_id' => 'event_type'),
+ ),
+ )
+ );
+ $form->add('text', 'participant_fee_id', ts('Fee Level'), array('class' => 'big crm-ajax-select'));