Form of...HTML!

If you put in an else block to go with the "if(write_button(...", it would be executed on the initial page load, but not after a successful save. It would be executed again on an unsuccessful save attempt (due to a field validation error), which may or may not be what you want.

count(fields) == 0 would be true only on the initial page load, with one possible exception: all your fields are checkboxes, and none of them are checked. If that's a potential problem, throw in a write_hidden() somewhere.

There is no such HTML tag as <save_text>, I don't know what you're trying to accomplish with that.
 
Now, it may be that you really do need to save the html; I don't know. But, first ask if it's necessary; would it perhaps be better to save the data, and document what it means, and then let others write what they wanted based on said data? If so, that should be easier, and cut down on file sizes even (ok, trivial issue these days, but still).

I have, however, found one use-case for being able to save data as straight text-file dumps that would be useful; debugging scripts that use visit_url() would require a bit less setup on a debugger's end if read_&write_file() were available. But even then, you can just set up a web server on your machine and visit_url("localhost-something-something").
 
Thanks Jason. I'll give that a go. My experience with html, CSS and javascript was nil until I began writing this script. It started out fairly neat, but as I tried to do increasingly difficult things it was harder and harder for me to keep things organized (it's hard to produce tight code when you don't quite understand all of it). All of which is to say, I named that tag so that I could target it with a CCS rule. I realize that that's probably horrible of me, but given that this was only my second attempt at a relay script and html in general (and my first at CCS and JS) I'm just pleased it worked, in fact I think it turned out quite well. Eventually I'll go back and make the code as nice as the user-side interface ;).

@StDoodle: Was that comment directed at me or Jason? If the former, I didn't understand much of that >_<
 
The first part was for you, the second more of general background info. Feel free to contact me in-game for more lengthy explanations; could be convoluted to discuss in this type of venue. ;)
 
Thanks StDoodle, I've got relay_Harvest.ash into a state I am happy with, though if I had to choose a metaphor for the coding style I ended up using it would probably involve a sledgehammer. When I work up the courage to redo the code I may take you up on your offer :).
 
Sorry for not reading the entire thread, but I have a really quick question. Is there a way to set a field after it's been created? I have something like this:

Code:
current = write_check(true, "test", "");

if (write_button("process", "Process")) { 
   fields["test"] = false;
}

But when I click the button the checkbox stays true.
 
write_check() actually emitted the HTML for the checkbox; nothing you can do after that point can change it. You can use test_button() to do things based on which button was clicked, at a point other than the write_button() that actually generated it.
 
I don't know if jason still even reads the forums at all, but it would be great if this could be put on svn to be used as a dependency.
 
Given that Bale seems to have figured out how to handle subprojects, I will be more than happy to have subprojects for community resources that I am not maintaining once I set up something on SourceForge. That seems like a reasonable service to offer so I will do it if no one beats me to it.
 
Given that Bale seems to have figured out how to handle subprojects, I will be more than happy to have subprojects for community resources that I am not maintaining once I set up something on SourceForge. That seems like a reasonable service to offer so I will do it if no one beats me to it.

I think you mean a project for community resources, with a subproject for each of those resources?
 
I don't know if jason still even reads the forums at all, but it would be great if this could be put on svn to be used as a dependency.
I see jason on the list of users every day, although he rarely posts.

Roippi's svn support is, perhaps, the best new feature of the year, and it is being adopted widely. What do you think, jason: put this up on svn to be included as a dependency by other scripts which are also on svn?
 
Yes, I guess it would make sense to have htmlform on SVN. Somebody else is going to have to host it, I don't have the option of a SVN server on my web hosting.
 
Yes, I guess it would make sense to have htmlform on SVN. Somebody else is going to have to host it, I don't have the option of a SVN server on my web hosting.

Everyone else is using sourceforge so far (maybe there's 1 exception so far). It took about a minute to create a new project when I set up a script there.
 
I could put it under my subprojects if needed, or someone else could do it. Bale seems to be happy to take care of projects as well :)
 
Ditto. Except for the appearance of trying to take credit for someone elses work I could, and would be willing to, host on SF with about 5 minutes work.
 
fronobulax's suggestion is clearly superior. Then jasonharper should be added as an admin for the project, giving him full control over it. (Just as if he'd created it himself.) I'd just wait for jason to agree.
 
I'll add the new project now and post here when it is done.

Edit: Project added. jasonharper is an admin. Unfortunately htmlform was already taken, so I had to use formhtml. You can check it out at:

svn checkout https://svn.code.sf.net/p/formhtml/code/
 
Last edited:
Back
Top