- From: Dave Makower <davemak@pencom.com>
- Date: Thu, 7 Nov 1996 12:30:15 -0500
- To: www-jigsaw@w3.org
Here is the html generated by the FormCardResource.
It seems that the HTML that results (eventually) from
addButton() causes a <form> tag without a </form> closing
tag. Perhaps this is what's causing the strange behavior
I described?
(NOTE: the actual Java code that generated this
is slightly different from what I sent previously,
but the important stuff is the same. Also note that
I inserted newlines in the following HTML.)
======================== BEGIN INSERTED HTML ========================
<html>
<head>
<title>Generating VirtualContainerResources and LeafResources forSimpleCTest_1</title>
</head>
<body>
<h1>Generating VirtualContainerResources and LeafResources forSimpleCTest_1</h1>
<h3>Parent: <a href="http://pc10117.pencom.com:9999/Admin/Editor/MetaAdmin/">MetaAdmin</a>
<h2>com.pencom.metamagic.c_code.SimpleCMetaRepository</h2>
<form action="http://pc10117.pencom.com:9999/Admin/Editor/editor@3/Generate+MetaRepository" method="POST">
<table width="100%">
</table>
<p>
<input type="submit" name="submit" value="Ok">
<input type="reset" name="submit" value="Reset">
</form>
<hr>
<form method="GET" action="http://pc10117.pencom.com:9999/Admin/Editor/editor@3/Generate+MetaRepository/Generate">
<input type="submit" name="BUTTONRESERVEDBUTTON" value="Generate">
<form method="GET" action="http://pc10117.pencom.com:9999/Admin/Editor/editor@3/Generate+MetaRepository/Delete">
<input type="submit" name="BUTTONRESERVEDBUTTON" value="Delete">
<hr>
<table>
<tr>
<th align=center>
<a href="http://pc10117.pencom.com:9999/Admin/Editor/editor@3/Attributes">Attributes</a> </th>
</tr>
</table>
</body>
</html>
=========================== END INSERTED HTML =============================
>Dave Makower writes:
> > I'm observing some strange behavior with the FormCardHandler class. (Using
> > Jigsaw 1.0a3)
> >
> > I have an editor class which extends GenericResourceEditor. In the
> > defineCards() method, I call a method that has the following code:
> >
> > MyHandler handler = new MyHandler(target);
> > FormCardResource card = defineCard(handler, "MyCardName", "MyCardTitle");
> > card.addButton("Generate");
> > card.addButton("Delete");
> >
> > Then, in the notifyButtonClick() method for the class MyHandler, I have the
> > following code:
> >
> > System.out.println("Got button click: \"" + label + "\".");
> >
> > The strange thing is that no matter which button I click, the label seems
> > to be "Generate" -- never "Delete". That is, the println statement always
> > causes the following console output:
> >
> > Got button click: "Generate".
> >
> > Why is this?
>
>That's strange, here are a few hints to chase the bug:
>
>a) Check the generated HTML, and make sure the buttons have the
> correct labels there (it should be the case).
>
>b) Hack the FormCardResource.lookup method, and add some traces, here
> is a sample of what can be done:
>
> public boolean lookup(LookupState ls, LookupResult lr)
> throws HTTPException
> {
> if ( super.lookup(ls, lr) )
> return true;
> String label = ls.getNextComponent() ;
> // Is this a valid button ?
> for (int i = 0 ; i < vbuttons.size() ; i++) {
> String button = (String) vbuttons.elementAt(i) ;
>System.out.println("FormCardResource: checking "+button+" against "+label);
> if ( button.equals(label) ) {
> // Notify the button click:
> try {
>System.out.println("FormcardResource: found "+label);
> handler.notifyButtonClick(label) ;
> } catch (FormProcessingException ex) {
> lr.setTarget(null);
> return false;
> }
> lr.setTarget(this);
> return true;
> }
> }
> // Unknown button:
> lr.setTarget(null);
> return true;
> }
>
>Let me know what happens with these traces...
>
>Anselm.
+---------------------+-------------------------+---------------------+
| Dave Makower | davemak@pencom.com | WWW Specialist |
+---------------------+-------------------------+---------------------+
| Co-author of "Java Programming Basics" (Henry Holt/MIS:Press) |
| http://www.pencom.com/javabasics/ |
+----------------------------------+----------------------------------+
| Pencom Web Works | (212) 513-7777 voice |
| Pencom Systems Inc. | (212) 513-1975 fax |
| 40 Fulton St. | |
| New York, NY 10038 | http://www.pencom.com/ |
+----------------------------------+----------------------------------+
Received on Thursday, 7 November 1996 12:29:07 UTC