English 中文(简体)
检查箱价值,写作至XML结果
原标题:Finding checkbox value, writing to XML result

I m 制作每周超文本电子邮件书写模板(重编文档名称)和Im ,使用ASP和XML作为背端。 锡马解放组织是司空见惯的。

我在此要问的是,根据表格上的检查箱是否受到检查,建立一个价值为检查和检查的XMl node。

I ve Trial using

If Request.QueryString("promotioncheck") = "on" Then
        Set objField = objDom.createElement("promotioncheck")
        objField.Text = "checked"
        objRecord.appendChild objField
Else
        Set objField = objDom.createElement("promotioncheck")
        objField.Text = "notchecked"
        objRecord.appendChild objField
        End If 

但是,当我这样做的时候,即便检查了检查箱,也看不到变化和产出。

在这里,我协会:

<%
If Request.Form("hidden") = "true" Then
    Dim objDom
    Dim objRoot
    Dim objRecord
    Dim objField
    Dim objFieldValue
    Dim objattID
    Dim objattTabOrder
    Dim objPI
    Dim blnFileExists
    Dim x
    Dim z
    Set objDom = server.CreateObject("Microsoft.XMLDOM")
    objDom.preserveWhiteSpace = True



    blnFileExists = objDom.LoadXML(server.mappath("./")& "/eg"&Day(Date)&"_"&Month(Date)&".xml")


    If blnFileExists = True Then

    For x = 1 To Request.Form.Count

    If instr(1,Request.Form.Key(x),"hidden") = 0 Then
        Set z = objDom.selectNodes("eg/stories/"&Request.Form.Key(x))
        Response.Write(Request.Form.Key(x))
        z.innerText = Request.Form(x)
    End If
Next 
Else

    Set objRoot = objDom.createElement("eg")
    objDom.appendChild objRoot
    Set objRecord = objDom.createElement("stories")
    objRoot.appendChild(objRecord)
    For x = 1 To Request.Form.Count


    If instr(1,Request.Form.Key(x),"hidden") = 0 Then
        Set objField = objDom.createElement(Request.Form.Key(x))
        objField.Text = Request.Form(x)
        objRecord.appendChild objField
    End If
    Next
    If Request.QueryString("promotioncheck") = "on" Then
        Set objField = objDom.createElement("promotioncheck")
        objField.Text = "checked"
        objRecord.appendChild objField
    Else
    Set objField = objDom.createElement("promotioncheck")
        objField.Text = "notchecked"
        objRecord.appendChild objField
        End If
End If
If blnFileExists = False then

    Set objPI = objDom.createProcessingInstruction("xml", "version= 1.0 ")

    objDom.insertBefore objPI, objDom.childNodes(0)
End If


objDom.save (server.mappath("./")& "/eg"&Day(Date)&"_"&Month(Date)&".xml")



Set objDom = Nothing
Set objRoot = Nothing
Set objRecord = Nothing
Set objField = Nothing
Set objFieldValue = Nothing
Set objattID = Nothing
Set objattTabOrder = Nothing
 Set objPI = Nothing

On Error Resume Next
End If
%>

这里还有带有检查箱的超文本。

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
     <title>EG Editor</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <script type="text/javascript">
     var number_of_nibs = 1;

     function addnib(){
     number_of_nibs ++;
     var title = document.createElement( h2 );
     title.innerHTML = "Story" + number_of_nibs;
     var nibformtitle = document.createElement( p );
     nibformtitle.innerHTML = "Title:<br><input type="text" name="nib"+   number_of_nibs +"_title" style="width: 400px;">";
     var nibformcontent = document.createElement( p );
      nibformcontent.innerHTML = "Content:<br><textarea cols="22" rows="7" name="nib"+ number_of_nibs + "_content" style="width: 400px;"></textarea>";
     var smallnewsdiv = eval("document.getElementById( smallnews )");
      smallnewsdiv.appendChild(title);
      smallnewsdiv.appendChild(nibformtitle);
      smallnewsdiv.appendChild(nibformcontent);
      }


     </script>
     </head>
     <body>
     <h1>EG Editor</h1>
      <p>Welcome to the EG Editor, your one stop shop for making your EG email</p>
     <p>Please Fill out the form like you would any other internet form, press save when your done</p>
     <p>Once you ve saved your content, you can then click on the link to the finished product, save the file as HTML (file->save as->html only option when saving), open in word and then Send to yourself (File->Send To->Mail Recipient) and biggity-bam you ve got your issue of EG</p>
    <h2>Main Stories</h2>
    <p>Here is where you put in your stuff for your Main stories</p>
    <form name="form1" action="Egbuilder.asp" method="post">
    <table>
    <tr>
    <td>Story One:</td>
    <td>Title: <input type="text" name="mainstory1_title" style="width: 220px"></td>
    <td>Content: <textarea cols="22" rows="7" name="mainstory1" style="width: 220px;"> </textarea></td>
    </tr>
    <tr>
    <td>Story Two:</td>
    <td>Title: <input type="text" name="mainstory2_title" style="width: 220px"></td>
    <td>Content: <textarea cols="22" rows="7" name="mainstory2" style="width: 220px;"></textarea></td>
    </tr>
    <tr>
    <td>Story Three:</td>
    <td>Title: <input type="text" name="mainstory3_title" style="width: 220px"></td>
    <td>Content: <textarea cols="22" rows="7" name="mainstory3" style="width: 220px;"></textarea></td>
    </tr>
    <tr>
    <td>Story Four:</td>
    <td>Title: <input type="text" name="mainstory4_title" style="width: 220px"></td>
     <td>Content: <textarea cols="22" rows="7" name="mainstory4" style="width: 220px;"></textarea></td>
    </tr>
    </table>
    <h2>Promotions</h2>
    <p>If there s a promotion this week then tick the  show promotion  box, Just pop your words into the box and then copy the Intranet link into the link box.</p>
   <p>Show Promotion? <input type="checkbox" name="promotioncheck" ></p>
   <p>Banner Text:<br>
   <textarea cols="22" rows="7" name="promotiontext" style="width: 400px;"></textarea></p>
   <p>Intranet Link: <br>
  <input type="text" name="promotionlink" style="width: 400px"></p>
  <div id="smallnews">
  <h2>News in Briefs</h2>
  <p>Here is where you add your smaller stories, you can add as many as you want. Just click the green plus button to add another box</p>
  <h3>Story 1</h3>
  <p>Title:<br>
  <input type="text" name="nib1_title" style="width: 400px"></p>
  <p>Content:<br>
 <textarea cols="22" rows="7" name="nib1_content" style="width: 400px;"></textarea>
  </p>
 </div>
 <p><a href="Javascript:addnib()" title="Press this button to add another button"><img src="images/add.jpg" alt="add button" style="width: 30px; height: 30px; border: 0px">Add another Story</a><input type="hidden" name="hidden" value="true"><input style="margin-left: 200px;" type="submit" value="Save" ></p>
</form>
</body>
 </html>

我确信,这确实很简单,我刚刚失去了一些基本的东西,但会得到任何帮助。 感谢

最佳回答

您目前重新从金字典中恢复晋升,但你重新调整了表格,使金字库集中赢得的价值。

相反,从表格收集中取回价值一样:

Request.Form("promotioncheck") = "on"

我可以记住,对于一个没有价值特性的检查箱来说,拖欠的回报值是古典正文,因此,“一”的双重检查正在退回。

问题回答

暂无回答




相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签