Jump to content

Javascript similar to concatenate not receiving data


Recommended Posts

I have a script that appears to be written correctly. I cannot find any reason why it should not work. However it is not receiving or submitting a parameter.

The variables prehtml and posthtml appear in the table in the field NewsTitleformatted, but the text from NewsTitle is missing. For example, if the data for NewsTitle is entered as Promotion Received, the data in the NewsTitleformatted field appears as . The "Promotion Received" text is not there.

The script is:

function Headline()

{

var between = document.getElementById("InsertRecordNewsTitle").value;

var prehtml = "";

var posthtml = "";

var bold = prehtml + between + posthtml;

document.getElementById("InsertRecordNewsTitleformatted").value=bold;

}

document.getElementById("caspioform").onsubmit=Headline();

Link to comment
Share on other sites

I would add two lines of code to the script in order to display the variable contents while running. This is one way of debugging.

<SCRIPT language="JavaScript">

function Headline()
{
var between = document.getElementById("InsertRecordNewsTitle").value;
alert(between);
var prehtml = "<font size=4><strong>";

var posthtml = "</strong></font>";

var bold = prehtml + between + posthtml;
alert(bold);
document.getElementById("InsertRecordNewsTitleformatted").value=bold;
}
document.getElementById("caspioform").onsubmit=Headline;
</SCRIPT>

Replace this code in your page (place the code in an HTML block at the bottom of the DataPage elements) and run the form and see what you get for those variables? I also removed the parentheses where you call the function.

Maybe this helps.

Cheers,

Barbara

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...