Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy can't I set my input field with MooTools?
    primarykey
    data
    text
    <p>Ive got a document and when the user enters something into one input I need to show a response in a second input box. I can get the user given value, i can process it, but when I try to set the second input box with the result I get the error $.field is null. Here is the code:</p> <pre><code>$('places').addEvent('keyup', function(){ var places = $('places').value; alert("PLACE: "+places); var price = values[places]; var nights = $('nights').value.toInt(); alert("NIGHTS: "+nights); var total = price * nights; alert("TOTAL: "+total); $('pricepernight').set('text', total); $('pricetotal').set('text', total - ((total / 100) * 21)); }); </code></pre> <p>So I get the place value. I pull the price of the place out of an assoc array. I then multiple that price by the amount of nights field in by the user and this is then my total amount. It is this amount that I cannot set to. Note that the alert shows the correct amount. </p> <p>and the html looks like this</p> <pre><code>&lt;div class='block'&gt; &lt;input type="text" id="places" /&gt; &lt;/div&gt; &lt;div class='block'&gt; &lt;label for="nachten"&gt;Aantal nachten&lt;/label&gt; &lt;input type="text" id="nights" /&gt; &lt;/div&gt; &lt;div class='block long'&gt; &lt;span class='label'&gt;Prijs per slaapplaats per nacht&lt;/span&gt; &lt;input type="text" class='resultfield' id='pricepernight' /&gt; &lt;/div&gt; &lt;div class='block last'&gt; &lt;span class='label'&gt;Totaalprijs excl. btw&lt;/span&gt; &lt;input type="text" class='resultfield' id='pricetotal'/&gt; &lt;/div&gt; </code></pre> <p>Firebug responds:</p> <pre><code>String contains an invalid character [Break On This Error] ...x:\'4W\',3X:18.1l,al:18.1l,1Q:18.1l,as:18.1l,8S:18.1l,1F:O,3E:{x:\'1u\',y:\'1o\'... </code></pre> <p>Any ideas/suggestions anyone? Thank you in advance! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload