comparison lib/js/urweb.js @ 1463:607657eb2865

Properly handle form textboxes that have sources
author Adam Chlipala <adam@chlipala.net>
date Sun, 29 May 2011 12:44:31 -0400
parents 17393c5e2b90
children f561025bb68e
comparison
equal deleted inserted replaced
1462:c12ceb891350 1463:607657eb2865
459 459
460 addNode(x); 460 addNode(x);
461 populate(x); 461 populate(x);
462 } 462 }
463 463
464 function input(x, s, recreate, type) { 464 function input(x, s, recreate, type, name) {
465 if (name) x.name = name;
465 if (type) x.type = type; 466 if (type) x.type = type;
466 x.dead = false; 467 x.dead = false;
467 x.signal = ss(s); 468 x.signal = ss(s);
468 x.sources = null; 469 x.sources = null;
469 x.recreate = recreate(x); 470 x.recreate = recreate(x);
471 populate(x); 472 populate(x);
472 473
473 return x; 474 return x;
474 } 475 }
475 476
476 function inp(s) { 477 function inp(s, name) {
477 var x = input(document.createElement("input"), s, 478 var x = input(document.createElement("input"), s,
478 function(x) { return function(v) { if (x.value != v) x.value = v; }; }); 479 function(x) { return function(v) { if (x.value != v) x.value = v; }; }, null, name);
479 x.value = s.data; 480 x.value = s.data;
480 x.onkeyup = function() { sv(s, x.value) }; 481 x.onkeyup = function() { sv(s, x.value) };
481 482
482 return x; 483 return x;
483 } 484 }