Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Creating stuff :)

From: stefan:falk:slg:se at: 29-Apr-2001 10:35

That's not quite it, so here comes a quite lengthy description of what I'm trying to do: First, I have a form asking how many questions and answers there is (the whole script is for adding an interview to a webpage, without having to deal with HTML), this is then sent to a rebol script that prints the following form (noq = number of questions): ;--------------- Only a small part of the form for count 1 noq 1 [ print rejoin [{ <tr> <td colspan="2"> <font face="Verdana" size="2"><b>Question } count {</b><br></font><textarea cols="60" rows="10" name="question} count {"></textarea><p> </td> </tr> <tr> <td colspan="2"> <font face="Verdana" size="2"><b>Answer } count {</b><br></font><textarea cols="60" rows="10" name="answer} count {"></textarea><p> </td> </tr> }] ] ;-------------------------------- after that, this form is sent to another rebol script that will add everything to a file: ;------------------------------------------------------------- create-interview: func [][ noq: data/noq date: now/date name: data/name nop: data/nop short: data/short short: replace/all short newline "<br>" intro: data/intro intro: replace/all intro newline "<br>" append feature-file 'type append feature-file type ; type: data/type was done earlier in the script append feature-file 'name append feature-file name append feature-file 'nop append feature-file nop append feature-file 'short append feature-file short append feature-file 'intro append feature-file intro url: data/url homepage: data/homepage append feature-file 'url append feature-file url append feature-file 'homepage append feature-file homepage append feature-file 'date append feature-file date noq: to-integer noq for count 1 noq 1 [ questionX: data/questionX answerX: data/answerX append feature-file 'QuestionX append feature-file questionX append feature-file 'AnswerX append feature-file answerX ] ;------------------------- And then it goes on to save the file. The problem is (I think) the way the form sends the data, as it sends it with the name(s) question1 question2 question3 etc.. answer1 answer2 answer3 etc.. This mean that even if I know the number of questions, I still have to change the number in a line of code to get the data. (Maybe I could use some sort of for loop to count through the data?) After this I need a script to print the questions, which would be easy to make if I can get this thing running. Hope this makes everything clearer! /Regards Stefan Falk