Adding default values for ttl and prio, closes #4

This commit is contained in:
Lukas Metzger 2016-03-28 16:48:35 +02:00
parent bda3384ad7
commit ec47c6b175
2 changed files with 10 additions and 4 deletions

View file

@ -158,8 +158,8 @@ limitations under the License.
</td>
<td><select id="addType" class="form-control select-narrow-70"></select></td>
<td><input id="addContent" type="text" class="form-control input-sm" data-regex="^.+$"></td>
<td><input id="addPrio" type="text" class="form-control input-sm" size="1" data-regex="^[0-9]+$"></td>
<td><input id="addTtl" type="text" class="form-control input-sm" size="3" data-regex="^[0-9]+$"></td>
<td><input id="addPrio" type="text" class="form-control input-sm" placeholder="0" size="1" data-regex="^[0-9]*$"></td>
<td><input id="addTtl" type="text" class="form-control input-sm" placeholder="86400" size="3" data-regex="^[0-9]*$"></td>
<td colspan="3"><button id="addButton" class="btn btn-success btn-sm">&nbsp;Add&nbsp;</button></td>
</tfoot>
</table>

View file

@ -331,11 +331,17 @@ function addRecord() {
return;
}
var prio = $('#addPrio').val();
if(prio.length === 0) prio = 0;
var ttl = $('#addTtl').val();
if(ttl.length === 0) ttl = 86400;
var data = {
type: $('#addType').val(),
content: $('#addContent').val(),
prio: $('#addPrio').val(),
ttl: $('#addTtl').val(),
prio: prio,
ttl: ttl,
action: "addRecord",
domain: location.hash.substring(1),
csrfToken: $('#csrfToken').text()