Disabling and Enabling inputs

141 views
Skip to first unread message

Lukasz Kuczera

unread,
Apr 19, 2011, 6:16:55 AM4/19/11
to Lift
Hi Folks,
I needed to disable/enable input on ajax submit but I didn't find code
for that, so I have created two simple classes:

import net.liftweb.http.js._

case class Disable(id: String) extends JsCmd {
def toJsCmd = "jQuery('#"+id+"').attr('disabled', 'true')" ;
}

case class Enable(id: String) extends JsCmd {
def toJsCmd = "jQuery('#"+id+"').removeAttr('disabled')" ;
}

If it is not some kind of reinventing the wheel it could be worth
putting alongside other JqJsCmds or if there is an interest I can
rewrite that to JsCmd.

Diego Medina

unread,
Apr 19, 2011, 11:21:04 AM4/19/11
to lif...@googlegroups.com

If it doesn't make into Lift, could you add them to the wiki?

Thanks

Diego

>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
>

--
Diego Medina
Web Developer
http://www.fmpwizard.com

David Pollak

unread,
Apr 19, 2011, 12:36:41 PM4/19/11
to lif...@googlegroups.com
On Tue, Apr 19, 2011 at 8:21 AM, Diego Medina <di...@fmpwizard.com> wrote:
On Tue, Apr 19, 2011 at 6:16 AM, Lukasz Kuczera <kuk...@gmail.com> wrote:
> Hi Folks,
> I needed to disable/enable input on ajax submit but I didn't find code
> for that, so I have created two simple classes:
>
> import net.liftweb.http.js._
>
> case class Disable(id: String) extends JsCmd {
>        def toJsCmd = "jQuery('#"+id+"').attr('disabled', 'true')" ;
> }
>
> case class Enable(id: String) extends JsCmd {
>  def toJsCmd = "jQuery('#"+id+"').removeAttr('disabled')" ;
> }
>
> If it is not some kind of reinventing the wheel it could be worth
> putting alongside other JqJsCmds or if there is an interest I can
> rewrite that to JsCm

If it doesn't make into Lift, could you add them to the wiki?

Or put them into a Lift module
 

Thanks

 Diego

>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
>



--
Diego Medina
Web Developer
http://www.fmpwizard.com

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net

Lukasz Kuczera

unread,
Apr 20, 2011, 6:25:30 AM4/20/11
to Lift
This "module" don't need any init its just a couple of classes. This
would be agains Lift modules, expected behaviour is to call init when
you include new module.
Sure I can if there is such will just let me know.

One thing that I would love to see in JqJsCmds is jquery selectors
instead of plain ids, overloading them with JqSelector argument would
do its job and would be backward compatible.

David Pollak

unread,
May 19, 2011, 8:03:44 PM5/19/11
to lif...@googlegroups.com

Please open a ticket for this feature.
 

>
> Or put them into a Lift module
>
>

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net

Antonio Salazar Cardozo

unread,
May 25, 2011, 8:32:10 AM5/25/11
to lif...@googlegroups.com
Hm. Correct me if I'm wrong, but isn't that what Jq("selector") does? e.g.

Jq(".person > button") ~> JqAttr("disabled", true)

Would produce $('.person > button').attr('disabled', true);
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages