Case à cocher Modifier / Cliquez sur l'événement pas de tir

J'ai un problème avec une case à cocher, cliquez sur événement.
Un utilisateur de remplir 5 entrées qui créer des variables globales de la valeur d'entrée.
Ensuite, l'utilisateur remplit le formulaire et clique ensuite une vérification de la case pour accepter les règles et les règlements. Cette case doit remplir un caché textarea avec les 5 variables avec pré-déterminé de texte.

Il semble fonctionner pour la plupart, cependant, je reçois des entrées vides. Par conséquent, la case à cocher à l'événement déclencheur n'est-ce pas de tir correctement. J'ai fait beaucoup de test du navigateur et ne peut pas identifier la cause.

Je suis en train de travailler avec certains de code personnalisé sur le Shortstack Application Plate-forme pour les concours/tirage au sort pour facebook.

J'ai essayé les deux méthodes suivantes pour déclencher l'événement, mais ni résout le problème.

$('#promotion_agree').change(function() {

et

$('#promotion_agree').on("click", function(event) { 

Mon code est ci-dessous. Toute aide est très appréciée.

<script type="text/javascript">
jQuery(document).ready(function($) {
//Fade out the Agree to Rules/Regulations checkbox
$('#promotion_agree_block').fadeOut();
//Input Field 1
$('#promotion_custom_field_2').bind("keyup change", function() {
fieldone = $(this).val();
$('#promotion_custom_field_5').val(fieldone);
});
//Input Field 2
$('#promotion_custom_field_3').bind("keyup change", function() {
fieldtwo = $(this).val();
$('#promotion_custom_field_7').val(fieldtwo);
});
//Input Field 3
$('#promotion_custom_field_4').bind("keyup change", function() {
fieldthree = $(this).val();
$('#promotion_custom_field_8').val(fieldthree);
});
//Input Field 4
$('#promotion_custom_field_17').bind("keyup change", function() {
fieldfour = $(this).val();
$('#promotion_custom_field_9').val(fieldfour);
});
//Input Field 5
$('#promotion_custom_field_18').bind("keyup change", function() {
fieldfive = $(this).val();
$('#promotion_custom_field_37').val(fieldfive);
$('#promotion_agree_block').fadeIn();  
});
////Post the global variables to the hidden textarea along with the included text
$('#promotion_agree').on("click", function(event) { 
//The following code is placed in the textarea field that is hidden
$('#promotion_image_description').html('' + fieldone + ' walked through The Fair, after     enjoying the Superdogs show where he saw lots of ' + fieldtwo + ', ' + fieldthree + ' dogs. They leapt through hoops and over jumps and ' + fieldfour + ' with their trainers. He thought about how great it would be if his dog ' + fieldfive + ' became a Superdog! Maybe one day...\r\n\r\n Submitted Words: ' + fieldone + ', ' + fieldtwo + ', ' + fieldthree + ', ' + fieldfour + ', ' + fieldfive + ''.replace(/\r\n/g, '\n').split('\n')); 
});
});
</script>

Modifier pour Origine le Post ci-Dessous...

Code HTML Ressemble à Ceci:

C'est ce que l'une des entrées ressemble:

<div class="field_block custom_field_2_field_block text_field_type_block center-input" id="promotion_custom_field_2_block">
<label for="promotion_custom_field_2"><span class="main_field_label">Field One</span><span class="required">*</span></label>
<input class="small" id="promotion_custom_field_2" name="promotion[custom_field_2]" type="text">
</div>

C'est la case qui déclenche l'événement de poster dans le textarea:

<div class="field_block agree_field_block black-text" id="promotion_agree_block" style="display: block;">
<label for="promotion_agree"><input id="promotion_agree" name="promotion[agree]" type="checkbox" value="1"> <span class="main_field_label">I have read and agree to the rules &amp; regulations</span><span class="required">*</span></label>
</div>

Zone de texte Ressemble à ça après la Case est cochée.

<div class="field_block image_description_field_block" id="promotion_image_description_block">
<label for="promotion_image_description"><span class="main_field_label">MadLib Story</span></label>
<textarea class="medium" id="promotion_image_description" name="promotion[image_description]">test1 walked through The Fair, after enjoying the Superdogs show where he saw lots of test2, test3 dogs. They leapt through hoops and over jumps and test4 with their trainers. He thought about how great it would be if his dog test5 became a Superdog! Maybe one day...

Soumis les Mots: test1, test2, test3, test4, test5

Deuxième Édition
Voici un montage de mon Code Javascript pour remplir le Champ Description de chaque élément est entré. Le formulaire ne sera pas remplir la description de texte sur "soumettre" pour certaines raisons, j'ai donc pensé que cela pourrait fonctionner:

<script type="text/javascript">
jQuery(document).ready(function($) {
$('#promotion_custom_field_2').bind("keyup change", function() {
//Create Global Variable for Text entered
fieldone = $(this).val();
//Add Global Variable to Hidden Field
$('#promotion_custom_field_5').val(fieldone);
//Update Description Field if Changed
$('#promotion_image_description').html('' + fieldone + ' walked through The Fair, after enjoying the Superdogs show where he saw lots of '
+ fieldtwo + ', ' + fieldthree + ' dogs. They leapt through hoops and over jumps and ' 
+ fieldfour + ' with their trainers. He thought about how great it would be if his dog ' 
+ fieldfive + ' became a Superdog! Maybe one day...\r\n\r\n Submitted Words: ' + fieldone + ', ' + fieldtwo + ', ' + fieldthree + ', ' + fieldfour + ', ' + fieldfive + ''.replace(/\r\n/g, '\n').split('\n'));
});
$('#promotion_custom_field_3').bind("keyup change", function() {
//Create Global Variable for Text entered
fieldtwo = $(this).val();
//Add Global Variable to Hidden Field
$('#promotion_custom_field_7').val(fieldtwo);
//Update Description Field if Changed
$('#promotion_image_description').html('' + fieldone + ' walked through The Fair, after enjoying the Superdogs show where he saw lots of '
+ fieldtwo + ', ' + fieldthree + ' dogs. They leapt through hoops and over jumps and ' 
+ fieldfour + ' with their trainers. He thought about how great it would be if his dog ' 
+ fieldfive + ' became a Superdog! Maybe one day...\r\n\r\n Submitted Words: ' + fieldone + ', ' + fieldtwo + ', ' + fieldthree + ', ' + fieldfour + ', ' + fieldfive + ''.replace(/\r\n/g, '\n').split('\n'));
});
$('#promotion_custom_field_4').bind("keyup change", function() {
//Create Global Variable for Text entered
fieldthree = $(this).val();
//Add Global Variable to Hidden Field
$('#promotion_custom_field_8').val(fieldthree);
//Update Description Field if Changed
$('#promotion_image_description').html('' + fieldone + ' walked through The Fair, after enjoying the Superdogs show where he saw lots of '
+ fieldtwo + ', ' + fieldthree + ' dogs. They leapt through hoops and over jumps and ' 
+ fieldfour + ' with their trainers. He thought about how great it would be if his dog ' 
+ fieldfive + ' became a Superdog! Maybe one day...\r\n\r\n Submitted Words: ' + fieldone + ', ' + fieldtwo + ', ' + fieldthree + ', ' + fieldfour + ', ' + fieldfive + ''.replace(/\r\n/g, '\n').split('\n'));
});
$('#promotion_custom_field_17').bind("keyup change", function() {
//Create Global Variable for Text entered
fieldfour = $(this).val();
//Add Global Variable to Hidden Field
$('#promotion_custom_field_9').val(fieldfour);
//Update Description Field if Changed
$('#promotion_image_description').html('' + fieldone + ' walked through The Fair, after enjoying the Superdogs show where he saw lots of '
+ fieldtwo + ', ' + fieldthree + ' dogs. They leapt through hoops and over jumps and ' 
+ fieldfour + ' with their trainers. He thought about how great it would be if his dog ' 
+ fieldfive + ' became a Superdog! Maybe one day...\r\n\r\n Submitted Words: ' + fieldone + ', ' + fieldtwo + ', ' + fieldthree + ', ' + fieldfour + ', ' + fieldfive + ''.replace(/\r\n/g, '\n').split('\n')); 
});
$('#promotion_custom_field_18').bind("keyup change", function() {
//Create Global Variable for Text entered
fieldfive = $(this).val();
//Add Global Variable to Hidden Field
$('#promotion_custom_field_37').val(fieldfive);
//Update Description Field if Changed
$('#promotion_image_description').html('' + fieldone + ' walked through The Fair, after enjoying the Superdogs show where he saw lots of '
+ fieldtwo + ', ' + fieldthree + ' dogs. They leapt through hoops and over jumps and ' 
+ fieldfour + ' with their trainers. He thought about how great it would be if his dog ' 
+ fieldfive + ' became a Superdog! Maybe one day...\r\n\r\n Submitted Words: ' + fieldone + ', ' + fieldtwo + ', ' + fieldthree + ', ' + fieldfour + ', ' + fieldfive + ''.replace(/\r\n/g, '\n').split('\n')); 
});
});
</script>
  • est le code à l'intérieur dom prêt.... partagez également le balisage html
  • Je vois que vous êtes en utilisant à la fois bind et on, la version de jQuery utilisez-vous? ... aussi, êtes-vous d'obtenir toutes les erreurs de la console?
  • Pas d'erreurs de la console. Il a vérifié avec IE outils de développement ainsi. Parce que je suis en utilisant shortstack, le formulaire est généré automatiquement donc je ne peux pas contrôler le html à l'exception de l'ajout d'une classe. Très difficile de tirer le html mais je vais voir ce que je peux rassembler.
  • Il suffit de copier le code HTML de l'élément inspecteur
  • Si je comprends bien, vous venez de stocker des valeurs dans un élément masqué que vous ne semblez pas être en utilisant d'ailleurs, alors, comment savez-vous que la fonction n'a pas été déclenchée?
  • J'ai ajouté quelques exemple de code HTML pour les éléments en question. Notez que l'entrée .lier les événements sont également l'affichage de la variable globale cachées des champs de saisie qui semble bien fonctionner sur tous les navigateurs: $('#promotion_custom_field_5').val(fieldone);

InformationsquelleAutor Jaden Nyberg | 2013-08-04