1

I use this code to fill text input

spooky.then([{question: question}, function(question) {
       this.fill('form[name="askmore"]', { questionask: question}, false);
 }]);

I have a valid sting in question. Here's a form markup:

<form action="" name="askmore" id="askmore" method="post" onsubmit="return false;">
<table cellspacing="0" cellpadding="0" border="0">
<tbody><tr><td>
<input type="text" maxlength="400" name="questionask" id="questionask" style="padding-left:15px; margin-left:45px; font-size:20px; width:480px; height:43px; border:0px; background-color:#d4d4d4; ">
</td>
<td>
<img hspace="15" src="/images/button.png" id="send" style="cursor: pointer;">
</td></tr></tbody></table></form>

Anyone know how to fix this? I think I'm doing it just like in the example from CasperJS documentation

dKab
  • 2,658
  • 5
  • 20
  • 35
  • 1
    It's dangerous to have an existing variable name as the first operand of object construction, instead of using quotes like `{"question": question}`. I know you do have a valid string, but can you still add a `console.log(question)` and `console.log(questionask)` in the anonymous function created, and add the displayed results to your question? – coyotte508 Jun 05 '16 at 22:18
  • What's the initial value of `question`? Have you tried to rename all appearances of `question` to `q` aside from the second one? – Artjom B. Jun 05 '16 at 22:28

1 Answers1

2

Simply don't pass question as an argument:

spooky.then([{question: question}, function() {
    this.fill('form[name="askmore"]', { questionask: question}, false);
}]);
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195