summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/regform.js56
1 files changed, 8 insertions, 48 deletions
diff --git a/public/regform.js b/public/regform.js
index e620b04..42bbd58 100644
--- a/public/regform.js
+++ b/public/regform.js
@@ -2,58 +2,18 @@ $(function() {
var num_members = 0;
var num_songs = 0;
- $('#add-member-button').click(function() {
+ $('#add-member-button').click(function(event) {
num_members += 1;
- $('#form-members').append(
- '<div class="member-info">' +
- ' <h4>Medlem nr. '+num_members+'<input type="button" name="delete" data-member="'+num_members+'" class="delete-member-button" value="X"></h4>' +
- ' <div class="field text required">' +
- ' <label for="band-member-'+num_members+'-name">Navn:</label>' +
- ' <input type="text" id="band-member-'+num_members+'-name" name="band[members]['+num_members+'][name]">' +
- ' </div>' +
- ' <div class="field text optional">' +
- ' <label>Instrument:</label>' +
- ' <input type="text" name="band[members]['+num_members+'][instrument]">' +
- ' </div>' +
- ' <div class="field class optional">' +
- ' <label>Alder:</label>' +
- ' <input type="text" name="band[members]['+num_members+'][age]" size="3" pattern="[0-9]{1,2}">' +
- ' </div>' +
- '</div>'
- )
+ $.get('member/new/' + num_members, function(data) {
+ $('#form-members').append(data);
+ });
});
- $('#add-song-button').click(function() {
+ $('#add-song-button').click(function(event) {
num_songs += 1;
- $('#form-songs').append(
- '<div class="song-info" id="song-'+num_songs+'-info">' +
- ' <h4>Låt nr '+num_songs+'<input type="button" id="delete-song-'+num_songs+'" class="delete-song" value="X"></h4>' +
- ' <div class="field text required">' +
- ' <label for="band-song-'+num_songs+'-title">Tittel:</label>' +
- ' <input type="text" id="band-song-'+num_songs+'-title" name="band[songs]['+num_songs+'][title]">' +
- ' </div>' +
- ' <div class="field text optional">' +
- ' <label for="band-song-'+num_songs+'-time">Lengde:</label>' +
- ' <input type="text" pattern="[0-9]{2}:[0-9]{2}" title="Spilletid i min:sek (mm:ss)" id="band-song-'+num_songs+'-time" name="band[songs]['+num_songs+'][time]" size="6">'+
- ' </div>' +
- ' <div class="field text optional">' +
- ' <label for="band-song-'+num_songs+'-isrc">ISRC-kode:</label>' +
- ' <input type="text" title="Dersom låten har vært utgitt før har den en ISRC-kode. Om du vet den så oppgi den her." id="band-song-'+num_songs+'-isrc" name="band[songs]['+num_songs+'][isrc]" size="11">'+
- ' </div>' +
- ' <div class="field textarea required">' +
- ' <label for="band-song-'+num_songs+'-performers">Utøvere:</label>'+
- ' <textarea cols="40" rows="5" id="band-song-'+num_songs+'-performers" name="band[songs]['+num_songs+'][performers]" title="Fullt navn (ingen pseudonymer) på alle som er med på denne innspillingen."></textarea>' +
- ' </div>' +
- ' <div class="field textarea required">' +
- ' <label for="band-song-'+num_songs+'-composers">Opphavsmenn:</label>'+
- ' <textarea cols="40" rows="5" id="band-song-'+num_songs+'-composers" name="band[songs]['+num_songs+'][composers]" title="Fullt navn (ingen pseudonymer) på alle som har vært med på å skrive denne låten."></textarea>' +
- ' </div>' +
- ' <div class="field textarea optional">' +
- ' <label for="band-song-'+num_songs+'-notes">Andre merknader:</label>'+
- ' <textarea cols="40" rows="5" id="band-song-'+num_songs+'-notes" name="band[songs]['+num_songs+'][notes]" title="Evt andre ting vi burde vite."></textarea>' +
- ' </div>' +
- '</div>'
- )
+ $.get('song/new/' + num_songs, function(data) {
+ $('#form-songs').append(data);
+ });
});
});