690fa17cbf29efbe0f1b6c9b724f4e3614a615fb galt Thu Mar 2 23:23:09 2017 -0800 fixes #18981. track search js problems from CSP2 changes. Needed to add id to some functions in cheapcgi.c and hui.c. diff --git src/lib/cheapcgi.c src/lib/cheapcgi.c index 22e40b6..f36804c 100644 --- src/lib/cheapcgi.c +++ src/lib/cheapcgi.c @@ -2018,65 +2018,75 @@ cgiMakeDoubleVarInRange(varName,initialVal,title,width,minStr,NULL); } void cgiMakeDoubleVarWithMax(char *varName, double initialVal, char *title, int width, double max) { char maxLimit[20]; char *maxStr=NULL; if ((int)max != NO_VALUE) { safef(maxLimit,sizeof(maxLimit),"%g",max); maxStr = maxLimit; } cgiMakeDoubleVarInRange(varName,initialVal,title,width,NULL,maxStr); } -void cgiMakeDropListClassWithStyleAndJavascript(char *name, char *menu[], +void cgiMakeDropListClassWithIdStyleAndJavascript(char *name, char *id, char *menu[], int menuSize, char *checked, char *class, char *style, struct slPair *events) -/* Make a drop-down list with names, text class, style and javascript. */ +/* Make a drop-down list with name, id, text class, style and javascript. */ { int i; char *selString; if (checked == NULL) checked = menu[0]; printf("<SELECT"); if (name) printf(" NAME='%s'", name); +if (events && !id) // use name as id + id = name; +if (id) + printf(" id='%s'", id); if (class) printf(" class='%s'", class); if (events) { - printf(" id='%s'", name); struct slPair *e; for(e = events; e; e = e->next) { - jsOnEventById(e->name, name, e->val); + jsOnEventById(e->name, id, e->val); } } if (style) printf(" style='%s'", style); printf(">\n"); for (i=0; i<menuSize; ++i) { if (sameWord(menu[i], checked)) selString = " SELECTED"; else selString = ""; printf("<OPTION%s>%s</OPTION>\n", selString, menu[i]); } printf("</SELECT>\n"); } +void cgiMakeDropListClassWithStyleAndJavascript(char *name, char *menu[], + int menuSize, char *checked, char *class, char *style, struct slPair *events) +/* Make a drop-down list with names, text class, style and javascript. */ +{ +cgiMakeDropListClassWithIdStyleAndJavascript(name,NULL,menu,menuSize,checked,class,style,events); +} + void cgiMakeDropListClassWithStyle(char *name, char *menu[], int menuSize, char *checked, char *class, char *style) /* Make a drop-down list with names, text class and style. */ { cgiMakeDropListClassWithStyleAndJavascript(name,menu,menuSize,checked,class,style,NULL); } void cgiMakeDropListClass(char *name, char *menu[], int menuSize, char *checked, char *class) /* Make a drop-down list with names. */ { cgiMakeDropListClassWithStyle(name, menu, menuSize, checked, class, NULL); } void cgiMakeDropList(char *name, char *menu[], int menuSize, char *checked)