Jump to content

Java document.write issue with new asynchonous deployment


Recommended Posts

I finally bit the bullet and re-deployed all of my DataPages with asynchronous deployment.  I'm having a problem writing a javascript that I used document.write for.  Any help would be greatly appreciated!!

 

<script type="text/javascript">
var cb_boolean = '[@field:Courses_Status]';
if(cb_boolean == 'Accepted')
{
if([@field:Courses_Student_Count] <[@field:Courses_Estimated_Attendance])
{
document.write("<a href='http://[@app:domain]/pm_admin/training/details/registerstudent/[@authfield:Account_regpath]index.html?Course_Number=[@field:Courses_Course_Number]' target='_blank'><b>Register Student</b></a>");
}
else
{
document.write("<p><b>Class Full</b></p>")
}
}
</script>
 

 

 

Link to comment
Share on other sites

You should use selector and custom html block in order to write information. Document.write() is not available due to security policy of the Chrome Browser.

 

Example of the code. You should use HTML block with disabled editor

 

<div id='elem'>

</div>

<script type="text/javascript">
    var cb_boolean = '[@field:Courses_Status]';
if(cb_boolean == 'Accepted'){

    if([@field:Courses_Student_Count] < [@field:Courses_Estimated_Attendance]){
        document.write("<a href='http://[@app:domain]/pm_admin/training/details/registerstudent/[@authfield:Account_regpath]index.html?Course_Number=[@field:Courses_Course_Number]' target='_blank'><b>Register Student</b></a>");
    }
    else{
        document.getElementById("elem").innerHTML="<p><b>Class Full</b></p>";
    }
}
</script>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...