customize signup / registration and make styling possible

143 views
Skip to first unread message

Matthias Fenz

unread,
Oct 26, 2012, 10:42:41 AM10/26/12
to lif...@googlegroups.com
Hi there,

i'm trying to customize the signup table generated via ProtoUser to be able to embed it into a /signup page. At the moment, I can route to /user/sign_up where the default tableset appears, but it is just embedded in white space and i'm not able to adjust the styling of the surrounding page.

Is it possible to use this generated table as a kind of snippet and to embed it into another page, e.g. a /signup page (or however it may be named)?

I modified my User.scala like this:

override def signupXhtml(user: TheUserType) = {

    <div class="signUpBox">
    <form method="post" action={S.uri}>
       <table class="testtable">
         <tr>
           <td colspan="2" class="signUpBoxHeader">{ S.??("sign.up") }</td>
         </tr>
        {localForm(user, false, signupFields)}
         <tr>
           <td>&nbsp;</td>
           <td><user:submit/></td>
         </tr>
        </table>
    </form>
    </div>
  }

Now I'm searching for any possibility to add this div "signUpBox" to any other page...

Every help or hint would be appreciated, thanks in advance everyone,
Matthias

David Pollak

unread,
Oct 26, 2012, 11:20:52 AM10/26/12
to lif...@googlegroups.com
object MySignupSnippet {
  def render = User.signupXhtml(new User)
}


--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
 
 
 



--
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net


Matthias Fenz

unread,
Oct 26, 2012, 11:31:42 AM10/26/12
to lif...@googlegroups.com
Hi David,

as I'm new to Lift, where shall I put this to? Also in User.scala? And can I call this by <lift:bind... oder <lift:embed... then?

Thanks in advance,
Matthias

David Pollak

unread,
Oct 26, 2012, 11:43:46 AM10/26/12
to lif...@googlegroups.com
Please read the first few chapters of http://simply.liftweb.net/ 

Matthias Fenz

unread,
Oct 26, 2012, 11:45:36 AM10/26/12
to lif...@googlegroups.com
aye aye sir! :)

thank you!

Alexey Lunacharsky

unread,
Oct 26, 2012, 10:47:11 PM10/26/12
to lif...@googlegroups.com
    Hi, Matthias

    This code is to be put under the your snippet package:

    package org.example.lift.snippet

    object MySignupSnippet {
      def render = User.signupXhtml(new User)
    }
      E.g. having such a line in Boot.scala 
      LiftRules.addToPackages("org.example.lift")
      After you have snippet code in the place, just put
      <div class="lift:MySignupSnippet"/> anywhere in one of yours HTML templates, and that should do the trick.
      Lift knows where to look for the snippet by 
      LiftRules.addToPackages("org.example.lift") above.

    пятница, 26 октября 2012 г., 22:31:42 UTC+7 пользователь Matthias Fenz написал:

    Matthias Fenz

    unread,
    Oct 27, 2012, 3:02:55 AM10/27/12
    to lif...@googlegroups.com
    Hi Alexey,

    thanks for that! Everything works except the <user:submit /> form, this is not displayed in the page... Is there anything I forgot?

    Matthias

    Alexey Lunacharsky

    unread,
    Oct 28, 2012, 2:41:18 AM10/28/12
    to lif...@googlegroups.com
    I'm not sure what would you want to achieve by this tag.

    Could you provide some source code you use?
    Preferably a sample on github?

    суббота, 27 октября 2012 г., 14:02:56 UTC+7 пользователь Matthias Fenz написал:

    Matthias Fenz

    unread,
    Oct 28, 2012, 3:48:37 AM10/28/12
    to lif...@googlegroups.com
    Well, i just want to say that the Submit-Button is not displayed in the page where the snippet is placed. All fields and labels are there, but there is no submit-form and when i try to submit by hitting enter, it doesn't work either. 

    Maybe i can provide some code later.

    Matthias  

    Matthias Fenz

    unread,
    Oct 28, 2012, 9:03:57 AM10/28/12
    to lif...@googlegroups.com

    Here the code, I do not have a Github account:

    ---------------------------------

    In User.scala



    override def signupXhtml(user: TheUserType) = {
        (<form method="post" action={S.uri}>
           <table class="signUpTable">

             <tr>
               <td colspan="2" class="signUpBoxHeader">{ S.??("sign.up") }</td>
             </tr>
            {localForm(user, false, signupFields)}
             <tr>
               <td>&nbsp;</td>
               <td><user:submit /></td>
             </tr>
            </table>
        </form>)

      }

    ----------------------------------

    In snippet/MySignupSnippet.scala




    object MySignupSnippet {
      def render = User.signupXhtml(new User)

    }

    ----------------------------------

    In signup.html



    <div class="lift:MySignupSnippet"></div>

    ----------------------------------

    That's all... The problem - as described - is, that all fields for signup routine (First-, Lastname, Email, PW, Locales, Timezone) are displayed as expected, but the Submit-Button is not there (see screenshot). Also when I try to confirm the fields by pressing Enter, the browser reloads but I am not redirected to the expected site and there is no new user in the database. I read a lot in Google groups and other sources, but I found nothing relating to my problem. I'm also new to Lift and Scala, so I haven't found any possibility to build a workaround... If you (or anybody other) has any idea how to solve this problem - I'd be very thankful!

    Greets, Matthias

    Alexey Lunacharsky

    unread,
    Oct 29, 2012, 4:08:09 AM10/29/12
    to lif...@googlegroups.com
    I hink you should try User.signup method instead of  User.signupXhtml(new User) in the snippet
    because as I see in the sources <user:submit/> is bind at that place:

        def innerSignup = bind("user",
                               signupXhtml(theUser),
                               "submit" -> signupSubmitButton(S.?("sign.up"), testSignup _))

    воскресенье, 28 октября 2012 г., 20:03:57 UTC+7 пользователь Matthias Fenz написал:

    Matthias Fenz

    unread,
    Oct 30, 2012, 8:26:01 AM10/30/12
    to lif...@googlegroups.com

    OK, I got the solution... It was so simple... I want to post it here if somebody comes around with the same problem:

    I just added the follwoing code to my User.scala:

    override def screenWrap: Box[Node] = Full(
        <lift:surround with="signup" at="content">
          <div id="box1" class="topbg">
              <lift:bind />
          </div>
        </lift:surround>
      )

    By this I achieved that the auto-generated signup-form from ProtoUser is rendered in my Signup.html file... Now I am able to style the complete site!

    Thanks to David and спасибо to Alexey for your help! :)

    Matthias

    Alexey Lunacharsky

    unread,
    Oct 30, 2012, 11:50:54 AM10/30/12
    to lif...@googlegroups.com
    You're welcome!

    вторник, 30 октября 2012 г., 19:26:01 UTC+7 пользователь Matthias Fenz написал:
    Reply all
    Reply to author
    Forward
    0 new messages