Home Action in grails form is not working
Reply: 0

Action in grails form is not working

user2396 Published in July 19, 2018, 9:44 am

I am trying to make a simple creation of account and when create button is clicked it should perform the action "create" but I get an error saying that
HTTP Status 404 - "/WEB-INF/grails-app/views/users/create.gsp" not found.

Here is my code block for the index.gsp

<div id="id02" class="modal">
  <g:form class="modal-content animate" controller="users" action="create">
    <div class="imgcontainer">
      <span onclick="document.getElementById('id02').style.display='none'" class="close" title="Close Modal">&times;</span>
        <div class="container" style="text-align:center">
            <b><h style="font-family: Arial, Helvetica, sans-serif; font-size: 30px">CREATE AN ACCOUNT</h></b><br/>
      <input type="text" placeholder="Enter Username" name="uname" required/>

      <input type="password" placeholder="Enter Password" name="psw" required/>

      <input type="text" placeholder="First Name" name="firstName" required/>

      <input type="text" placeholder="Last Name" name="lastName" required/>

      <input type="text" placeholder="Age" name="age" required/>
      <input type="date" placeholder="Birth Date" name="birthdate" required/>
      <input type="text" placeholder="Student Number" name="studno" required/><br/>

        <input type="checkbox" checked="checked" name="remember"> Remember me</input>
      <button type="submit" style="width: 100px; margin-right:10px;" >Create</input>
      <button type="button" onclick="document.getElementById('id02').style.display='none'" class="cancelbtn">Cancel</button>


and Here is my code block for the usersController.

class usersController {    
    def index(){}
    def create()
        new Users(userid:params.uname,password:params.psw).save()
        new UserInfo(studentno:params.studno,age:params.age,birth_date:params.birthdate,first_name:params.firstName,last_name:params.lastName,user_id:params.uname).save()

And here's the error

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.309782 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO