Home  >  Q&A  >  body text

Enable/disable the setting of the default value of this option

The name="status" form in

admin_edit.html is enabled or disabled by default. It will not change due to the status value of the database. I made the following judgment for this form. The result cannot be displayed. Why and how to obtain it? status and display the value in the edit page

{eq name="$user_info.status" value=1}
<option value="1" selected>Enable</option>
<option value="0" >Do not enable</option>
{else /}
{eq name="$user_info.status" value="0"}
< ;option value="1">Enable</option>
<option value="0" selected >Disable</option>
{/eq}
{/eq}

**军**军2090 days ago1250

reply all(5)I'll reply

  • 天蓬老师

    天蓬老师2019-02-22 16:36:43

    If you look at the source code, this enabling and disabling function should not be done, it just provides an entrance.

    reply
    0
  • **军

    You know, I added it myself, just by following the above method. There are bugs in some parts of the source code. It would be more conducive to learning if you deal with it yourself. The code is basically repetitive, and it makes your head hurt to look for bugs.

    **军 · 2019-02-23 06:17:16
  • **军

    **军2019-02-21 23:59:49

    First of all, because the getter changes the values ​​​​of 0 and 1 into enabled/disabled/administrator/super administrator strings, the value here is the above value instead of 0 and 1, and the value in option It should be exactly the same as the string above

    reply
    0
  • **军

    **军2019-02-21 23:10:58

    The reason for not displaying is found. Because the value of value is a string, and the value of $user_info.status is 1 or 0, so the selected ones will be judged as false and will not be displayed. So how to change the status of the database? What about passing the value into the pop-up admin_edit.html?

    reply
    0
  • Cancelreply