Scripts in the html returned will be executed (<script>...</script>)

http://struts.apache.org/2.x/docs/ajax-and-javascript-recipes.html#AjaxandJavaScriptRecipes-ExecuteJavaScriptinthereturnedcontent

musachy

On 6/20/07, FanCo <[EMAIL PROTECTED]> wrote:


I didn't set the executeScripts attribute for the DIV. So the default
value
should be false. What is the function of this attribute if it is true?


newton.dave wrote:
>
> Does your <s:div.../> have executeScripts="true"?
>
> d.
>
> --- FanCo <[EMAIL PROTECTED]> wrote:
>
>>
>>      I am developing a web page which contains two
>> layouts (left & right). On the
>> left side, there are some buttons. And the right
>> side, it is a DIV which use
>> <s:div/> to create. It will invoke the JavaScript to
>> send a request to one
>> specific S2 action and updates the div with the
>> return page when click the
>> button. The updated page on the right side is always
>> a form containing some
>> fields. I want to send the form with AJAX without
>> refresh the whole page.
>> The JavaScript is using the dojo.io.bind() to send
>> an asynchronous request
>> to S2 action to obtain the web page. Then use the
>> callback to update the
>> DIV. It works fine with the JavaScript to update the
>> DIV. My problem is the
>> AJAX of the form in the updated page doesn’t work.
>> When I click the submit
>> button, it works like the normal form and refresh
>> the whole page.
>> The code of the form is something like the
>> following:
>> <struts:head theme="ajax"/>
>> ……
>> <struts:form method="post" id="testForm"
>> action="update" theme="ajax" >
>> <TABLE>
>>      <tr>
>>              <td><struts:textfield name="descBean.name"/></td>
>>      </tr>
>>      <tr>
>>              <td><struts:textfield
>> name="descBean.address"/></td>
>>      </tr>
>>      <tr>
>>              <td>
>>                      <struts:submit value="Save" align="left"
>> targets="updateDiv"/>
>>              </td>
>>      </tr>
>> </table>
>> </struts:form>
>>
>> And the JavaScript is the following:
>> function Connector(updateTargetArray){
>>      // the ids of the target div
>>      this.targetsArray = updateTargetArray;
>> }
>>
>> Connector.prototype.send = function(location){
>>      dojo.io.bind({
>>              url: location,
>>              handle: dojo.lang.hitch(this, this.bindHandler),
>>              mimetype: "text/html"
>>      });
>> }
>>
>> Connector.prototype.bindHandler = function(type,
>> data, e) {
>>      if(type == "load") {
>>              this.setContent(data);
>> }
>> }
>>
>> Connector.prototype.setContent = function(text){
>> if(this.targetsArray) {
>>              if (this.targetsArray instanceof Array){
>>                      for( var i=0; i<this.targetsArray.length; i++){
>>                              var node = dojo.byId(this.targetsArray
[i]);
>>                              node.innerHTML = text;
>>                      }
>>              }
>>              else {
>>                      var node = dojo.byId(this.targetsArray);
>>                      node.innerHTML = text;
>>              }
>> }
>>
>> The onClick event of the button will invoke the
>> Connector.send(location) to
>> send the request.  The form code works fine in an
>> individual page. I am not
>> quite sure which part is wrong. Does anyone can help
>> me? Thank you so
>> much!~~~
>>
>> --
>> View this message in context:
>>
>
http://www.nabble.com/Ajax-form-submission-doesn%27t-work-after-the-DIV-is-updated-tf3952031.html#a11212235
>> Sent from the Struts - User mailing list archive at
>> Nabble.com.
>>
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> [EMAIL PROTECTED]
>> For additional commands, e-mail:
>> [EMAIL PROTECTED]
>>
>>
>
>
>
>
>
____________________________________________________________________________________
> Luggage? GPS? Comic books?
> Check out fitting gifts for grads at Yahoo! Search
> http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

--
View this message in context:
http://www.nabble.com/Ajax-form-submission-doesn%27t-work-after-the-DIV-is-updated-tf3952031.html#a11214704
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Reply via email to