mothra: <button> tag form handling
This commit is contained in:
parent
65e50862cf
commit
cfea121378
1 changed files with 11 additions and 1 deletions
|
@ -43,6 +43,7 @@ enum{
|
||||||
RADIO,
|
RADIO,
|
||||||
SUBMIT,
|
SUBMIT,
|
||||||
RESET,
|
RESET,
|
||||||
|
BUTTON,
|
||||||
SELECT,
|
SELECT,
|
||||||
TEXTWIN,
|
TEXTWIN,
|
||||||
HIDDEN,
|
HIDDEN,
|
||||||
|
@ -58,6 +59,7 @@ struct Option{
|
||||||
void h_checkinput(Panel *, int, int);
|
void h_checkinput(Panel *, int, int);
|
||||||
void h_radioinput(Panel *, int, int);
|
void h_radioinput(Panel *, int, int);
|
||||||
void h_submitinput(Panel *, int);
|
void h_submitinput(Panel *, int);
|
||||||
|
void h_buttoninput(Panel *, int);
|
||||||
void h_submittype(Panel *, char *);
|
void h_submittype(Panel *, char *);
|
||||||
void h_submitindex(Panel *, char *);
|
void h_submitindex(Panel *, char *);
|
||||||
void h_resetinput(Panel *, int);
|
void h_resetinput(Panel *, int);
|
||||||
|
@ -148,7 +150,8 @@ void rdform(Hglob *g){
|
||||||
else
|
else
|
||||||
f->maxlength=atoi(s);
|
f->maxlength=atoi(s);
|
||||||
s=pl_getattr(g->attr, "type");
|
s=pl_getattr(g->attr, "type");
|
||||||
/* bug -- password treated as text */
|
if(g->tag == Tag_button && (s==0 || cistrcmp(s, "reset") || cistrcmp(s, "button")))
|
||||||
|
s = "submit";
|
||||||
if(s==0 || cistrcmp(s, "text")==0 ||
|
if(s==0 || cistrcmp(s, "text")==0 ||
|
||||||
cistrcmp(s, "password")==0 || cistrcmp(s, "int")==0 ||
|
cistrcmp(s, "password")==0 || cistrcmp(s, "int")==0 ||
|
||||||
cistrcmp(s, "email")==0){
|
cistrcmp(s, "email")==0){
|
||||||
|
@ -175,6 +178,8 @@ void rdform(Hglob *g){
|
||||||
f->type=RADIO;
|
f->type=RADIO;
|
||||||
else if(cistrcmp(s, "submit")==0)
|
else if(cistrcmp(s, "submit")==0)
|
||||||
f->type=SUBMIT;
|
f->type=SUBMIT;
|
||||||
|
else if(cistrcmp(s, "button")==0)
|
||||||
|
f->type=BUTTON;
|
||||||
else if(cistrcmp(s, "image")==0){
|
else if(cistrcmp(s, "image")==0){
|
||||||
/* presotto's egregious hack to make image submits do something */
|
/* presotto's egregious hack to make image submits do something */
|
||||||
if(f->name){
|
if(f->name){
|
||||||
|
@ -348,6 +353,9 @@ void mkfieldpanel(Rtext *t){
|
||||||
case RESET:
|
case RESET:
|
||||||
f->p=plbutton(0, 0, f->value[0]?f->value:"reset", h_resetinput);
|
f->p=plbutton(0, 0, f->value[0]?f->value:"reset", h_resetinput);
|
||||||
break;
|
break;
|
||||||
|
case BUTTON:
|
||||||
|
f->p=plbutton(0, 0, f->value[0]?f->value:"button", h_buttoninput);
|
||||||
|
break;
|
||||||
case SELECT:
|
case SELECT:
|
||||||
f->pulldown=plgroup(0,0);
|
f->pulldown=plgroup(0,0);
|
||||||
scrl=plscrollbar(f->pulldown, PACKW|FILLY);
|
scrl=plscrollbar(f->pulldown, PACKW|FILLY);
|
||||||
|
@ -436,6 +444,8 @@ void h_resetinput(Panel *p, int){
|
||||||
}
|
}
|
||||||
pldraw(text, screen);
|
pldraw(text, screen);
|
||||||
}
|
}
|
||||||
|
void h_buttoninput(Panel *p, int){
|
||||||
|
}
|
||||||
void h_edit(Panel *p){
|
void h_edit(Panel *p){
|
||||||
plgrabkb(p);
|
plgrabkb(p);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue