[php] 填寫joomla的表單字段



0 Answers

Question

我有一個簡單的形式與joomla。 我有兩個電子郵件字段:

echo $this->form->getLabel('email1');
echo $this->form->getInput('email1');

echo $this->form->getLabel('email2');
echo $this->form->getInput('email2');

我試圖填補這些領域時,用戶已經登錄,但我有一個問題。 這裡是代碼:

$user = JFactory::getUser();
$login = false;
if(!$user->get('guest')){
    $login = true;
    $email = $user->email;
}
...
echo '<input type="text" name="jform[email1]" class="validate-email required" id="jform_email1" value="'.$email.'" size="30" required="required" aria-required="true" disabled/><br>';
echo '<input type="hidden" name="jform[email2]" class="validate-email required" id="jform_email2" value="'.$email.'" size="30" required="required" aria-required="true" disabled/>';

在輸出中,字段的類型變為

<input type="email" name="jform[email1]" class="validate-email required" id="jform_email1" value="mail@mymail.com" size="30" required="required" aria-required="true" disabled="">
<input type="email" name="jform[email2]" class="validate-email required" id="jform_email2" value="mail@mymail.com" size="30" required="required" aria-required="true" disabled="">

我只想禁用這些字段並隱藏第二個字段

感謝您的幫助






Related



Tags

php php   joomla