Jump to content

Line Break?


Brandie

Recommended Posts

Can anyone help me add a hard return before and after this line? 

I've tried \n and \r and <br> to no avail. 
I'm a graphic designer, not a coder - halp! haha 
 

if (Field("Program2") == "")
    return "";

else       
	return 
//line break HERE
Field("Program2abbr") + ' Student Sponsorship of Up to ' + val 
//line break HERE
        ;
    }

 

Link to comment
Share on other sites

Not sure if this is what you are looking for. Make sure to check the box for "Treat Return Strings As Tagged Text"

 

if(Field("Program2") == "")
{
    return ""
}
else       
{    
return '<br>' + Field("Program2abbr") + '&nbsp;' + "Student Sponsorship of Up to" + '&nbsp;' + Field("val")+ '<br>'; 
}
 

Link to comment
Share on other sites

Newlines should work, but you need to include them in a literal string, between quotes, like so:

if (Field("Program2") == "")
    return "";

return "\n" + Field("Program2abbr") + ' Student Sponsorship of Up to ' + val + "\n";

You can also use <br> tags as Alex suggests, but in that case, I would recommend calling TaggedDataField instead of Field, in case the data contains "special" characters such as ampersands, like so:
 

if (Field("Program2") == "")
    return ""

return '<br>' + TaggedDataField("Program2abbr") + '&nbsp;' + "Student Sponsorship of Up to" + '&nbsp;' + val + '<br>'; 

Though the first version seems simpler.
 

Note also that you don't need the "else" statement after the "return".

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.

×
×
  • Create New...