Frage

I have this snippet:

<div width="300px">
  <form class="lift:LoginForm.logIn?form=post" id="myform">
    <fieldset>
      <input  type="email" id="l_n" name="name"/>
      <input type="password"  id="l_p"  name="password"/>
      <input type="submit"   value=">>" />
    </fieldset>
  </form>
</div>

my problem is with the name="password" part. If I leave it as is, it is posting:

F811969795583JEBN3R aa@aa.com
F811969795584PURKON aaaa
F81196979558535XAIK true
F8119698955864YQEGF >>

F811969795631ROXIJO=aa%40aa.com&F811969795632SDW2QF=aaaa&F811969795633KC5QWR=true&F811969895634KA2IAC=%3E%3E

BUT my password field gets "unmasked" (somehow it's changing it to a regular edit field. On the other hand, my method is getting the values correctly.

If I change my HTML code this way (I changed name='password' to name='pwd')

<div width="300px">
  <form class="lift:LoginForm.logIn?form=post" id="myform">
    <fieldset>
       <input  type="email" id="l_n" name="name"/>
       <input type="password"  id="l_p"  name="pwd"/>
       <input type="submit"  value=">>" />
     </fieldset>
   </form>
 </div>

my password field is correctly masked, but it is posting differently and I can't seem to get to "pwd" value.

F811969795611FN3BXU aa@aa.com 
F811969895612OASG4Z >> 
pwd                 aaaa

F811969795611FN3BXU=aa%40aa.com&pwd=aaaa&F811969895612OASG4Z=%3E%3E

As a newbie, I'm thoroughly confused. What am I missing? What is name='password' doing to my form?

I am using latest stable versions of Scala, Lift, and FoBo.

War es hilfreich?

Lösung

You'd need to post your snippet in addition to the HTML for any more specifics, but I would suspect your CSS transformation is keying on the name of pwd, like:

"@password" #> SHtml.password(...)

That will look for any element inside the snippet invocation and replace it with a password field. When you change the name, Lift can no longer find the field to transform and you can see your original input is being submitted.

Incidentally, your other fields are also being transformed, but most likely using SHtml.text which will replace your input with a Lift generated input. Names like F811969795611FN3BXU are GUID identifiers which correspond to functions created on the Server which will be called on submit to process the value. You can see some more on that here.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top