Note that there are some explanatory texts on larger screens.

plurals
  1. POGeddy - create new item
    primarykey
    data
    text
    <p>I am an absolute beginner in node.js and geddy. I've followed a few tutorials and now I try to write something similar for my purposes. </p> <p>When I try to create a new item, though, I get the following message: </p> <pre><code>/arithmetic_problem_types/function%20(id)%20%7B%20%20%20%20%20%20options.id%20=%20id;%20%20%20%20%20%20return%20helpersBase.urlFor.action(options);%20%20%20%20%7D not found. </code></pre> <p>I have no idea where this could come from. I've looked through the code and found nothing.</p> <p>Controller:</p> <pre><code>var ArithmeticProblemTypes = function () { this.respondsWith =[ 'html', 'json', 'xml', 'js', 'txt']; this.index = function (req, resp, params) { var self = this; geddy.model.ArithmeticProblemType.all(function (err, arithmetic_problem_types) { self.respond({ params: params, arithmetic_problem_types: arithmetic_problem_types }); }); }; this.add = function (req, resp, params) { this.respond({ params: params }); }; this.create = function (req, resp, params) { var self = this, arithmetic_problem_type = geddy.model.ArithmeticProblemType.create({ name: '1', title: 'open', numberType: '1', numberRanges: '1', operators: '1', askedFor: '1', specialProblemCategory: '1', askedForNumDenomOrBoth: '1', reducedFractions:'1', mixedFractions: '1' }); arithmetic_problem_type.save(function (err, data) { if (err) { params.errors = err; self.transfer('add'); } else { self.redirect({ controller: self.name }); } }); }; .................................................................... }; exports.ArithmeticProblemTypes = ArithmeticProblemTypes; </code></pre> <p>add.html.ejs</p> <pre><code>&lt;div class="hero-unit"&gt; &lt;%= partial('_form', {params: params}); %&gt; &lt;/div&gt; </code></pre> <p>index.html.ejs</p> <pre><code>&lt;div class="hero-unit"&gt; &lt;h2&gt;Arithmetic Problem Types List&lt;/h2&gt; &lt;%- linkTo('Create a new Aritmetic Problem Type', addArithmeticProblemTypePath, {class: 'btn pull-right'}) %&gt; &lt;/div&gt; &lt;% if (arithmetic_problem_types &amp;&amp; arithmetic_problem_types.length) { %&gt; &lt;% for (var i in arithmetic_problem_types) { %&gt; &lt;div class="row todo-item"&gt; &lt;div class="span8"&gt; &lt;h3&gt;&lt;%- linkTo(arithmetic_problem_types[i].title, arithmeticProblemTypePath(arithmetic_problem_types[i].id)) %&gt;&lt;/h3&gt; &lt;/div&gt; &lt;div class="span4"&gt;&lt;h3&gt;&lt;i class="icon-list-alt"&gt;&lt;/i&gt;&lt;%= arithmetic_problem_types[i].status; %&gt;&lt;/h3&gt;&lt;/div&gt; &lt;/div&gt; &lt;% } %&gt; &lt;% } %&gt; </code></pre> <p>How can I get rid of that message and make it work?</p> <p><strong>EDIT:</strong> This is the beginning of the _form.html.ejs file:</p> <pre><code>&lt;% var isUpdate = params.action == 'edit' , formTitle = isUpdate ? 'Update this Arithmetic Problem Type' : 'Create a new Arithmetic Problem Type' , action = isUpdate ? arithmeticProblemTypePath(params.id) + '?_method=PUT' : arithmeticProblemTypePath , deleteAction = isUpdate ? arithmeticProblemTypePath(params.id) + '?_method=DELETE' : '' , btnText = isUpdate ? 'Update' : 'Add' , nameValue = isUpdate ? arithmeticProblemTypePath.name : '' , errors = params.errors; %&gt; &lt;form id="arithmetic-problem-type-form" class="form-horizontal" action="&lt;%= action %&gt;" method="POST"&gt; .... &lt;/form&gt; </code></pre> <p><strong>EDIT2:</strong> Inspecting the page where I should write the name of the item and click the add button, I've found this</p> <pre><code>&lt;div class="hero-unit"&gt; &lt;form id="arithmetic-problem-type-form" class="form-horizontal" action="function (id) { options.id = id; return helpersBase.urlFor.action(options); }" method="POST"&gt; &lt;fieldset&gt; &lt;legend&gt;Create a new Arithmetic Problem Type&lt;/legend&gt; &lt;div class="control-group"&gt; &lt;label for="title" class="control-label"&gt;Title&lt;/label&gt; &lt;div class="controls"&gt; &lt;input class="span6" name="name" placeholder="enter name" type="text"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-actions"&gt; &lt;input class="btn btn-primary" type="submit" value="Add"&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>Indeed the message comes from the action attribute of the form element, but how can I solve it?</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