SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with "SyntaxError: Unexpected EOF" error

    I'm using query's ui dialog and i'm adding a form to the dialog box. If I use any spaces or returns between the tags I get the following error: SyntaxError: Unexpected EOF

    If I move everything onto one line it fixes the problem, but it is obviously very difficult to read. Is there another way to handle this?

    here is the script (it is working but difficult to read and make changes to)
    HTML Code:
    $(document).ready(function() {
    	var $dialog = $("<div></div>")
    		.html("<form action='scripts/proc_registered_user.php' method='post' name='form' id='form' accept-charset='utf-8'><fieldset><input type='hidden' name='unreguser' value='%s' id='unreguser' /> <br /><h1>This is an unregistered user.</h1><p>....</p></fieldset><br /><p id='mail_submit'><input type='submit' value='Yes, Send an email' /></p></form>")
    		.dialog({
    			autoOpen: false,
    			title: 'Basic Dialog'
    		});
    
    	$('#opener').click(function() {
    		$dialog.dialog('open');
    		// prevent the default action, e.g., following a link
    		return false;
    	});
    });
    
    </script>

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just remembered my form is being generated with dynamic content from the database. So instead how do I grab the form which is in a div with id='form' and insert it into the .html() part of the dialog function?

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    never mind figured out the problem here it is if anyone else needs it:
    HTML Code:
    $(document).ready(function() {
    		var $dialog = $("<div></div>")
    			.html($('#email_form').html())
    			.dialog({
    				autoOpen: false,
    				title: 'Basic Dialog'
    			});
    
    		$('#opener').click(function() {
    			$dialog.dialog('open');
    			// prevent the default action, e.g., following a link
    			return false;
    		});
    	});


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •