Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to pass URL of current page to form field on linked to page? Reply To: How to pass URL of current page to form field on linked to page?

#177648
__
Participant

It’s giving me a Syntax Error: Unexpected token ILLEGAL
document.form[0].00N9000000ApJSm.value

Property names can’t start with numbers.
You could use the index accessor syntax, like so:

document.form[0]['00N9000000ApJSm'].value

…but it would make more sense to choose a valid name, or add a prefix (e.g., _00N900…).

I have been working on it in PHP, but the problem is that WordPress doesn’t let you execute PHP within a page. I tried a couple of the plugins that let you execute PHP in a page but they are all throwing errors just installing them.

This is a limitation of WP that you need to come to terms with, either by abandoning such attempts, learning how to write WP plugins, or abandoning WP itself.

Do not use WP plugins that allow you to enter/run arbitrary PHP code. The whole idea is a basic security flaw. Uninstall them and make sure that the plugin scripts are actually removed from your server.

BTW, why doesn’t the Block Code function work very well?

Are you talking about the button here on the forum? It is just a shortcut for markdown. For block code, your text needs to look like this (pretend the apostrophes are backtics):

'codecodecode
codecodecode
codecodecode
'

That’s backtic + all your code + new line + backtic + new line