Idiot proof dialog ;-)

This commit is contained in:
Thomas Tanghus 2012-06-25 19:33:51 +02:00
parent ad5aa5ac15
commit 2ad93849ab
2 changed files with 12 additions and 5 deletions

View File

@ -302,7 +302,7 @@ Contacts={
modal: true, height: 'auto', width: 'auto',
buttons: {
'Ok':function() {
Contacts.UI.Card.add(';;;;;', '',$('#selectaddressbook_dialog').find('select').val(), true);
Contacts.UI.Card.add(';;;;;', '',$('#selectaddressbook_dialog').find('input:checked').val(), true);
$(this).dialog('close');
},
'Cancel':function() { $(this).dialog('close'); }

View File

@ -1,10 +1,17 @@
<div id="selectaddressbook_dialog" title="<?php echo $l->t("Select Address Books"); ?>">
<form>
<select id="adr_type" name="parameters[ADR][TYPE]" size="1">
<?php foreach($_['addressbooks'] as $addressbook) { ?>
<option value="<?php echo $addressbook['id']; ?>"><?php echo $addressbook['name']; ?></option>
<table>
<?php foreach($_['addressbooks'] as $idx => $addressbook) { ?>
<tr>
<td>
<input id="book_<?php echo $addressbook['id']; ?>" name="book" type="radio" value="<?php echo $addressbook['id']; ?>" <?php echo ($idx==0?'checked="checked"':'')?>>
</td>
<td>
<label for="book_<?php echo $addressbook['id']; ?>"><?php echo $addressbook['name']; ?></label>
</td>
</tr>
<?php } ?>
</select>
</table>
</form>
</div>