仅当字段中有数据时,我才尝试将数据从一个字段推到另一字段。如果Requeter_UserName_COAS中有数据,那么我希望将该数据推送到Requester_UserName字段。这是我对字段集(文本字段)的代码,对帮助onchange函数有什么建议吗?
$form['fieldform']['coas']['Requester_UserName_COAS'] = array(
'#type' => 'textfield',
'#title' => t('Faculty Name'),
'#required' => TRUE,
'#attributes' => array( 'placeholder' => "Alex Jones",
'required' => "required",
),
'#prefix' => '<div class="forms-jd">',
'#suffix' => '</div>',
'onchange' => "if($(this).val() = True) {this.form.elements['Requester_UserName'].value = 'Requester_UserName_COAS';}",