Jump to content

Recommended Posts

Hi!

First of, I want to say that I don't have a lot of knowledge with js, so please bare with me.

 

I have this function:

 	function formFunction() {
 		return new LightFace({
 			title: $('demo1title').value,
 			content: $('demo1content').value,
			draggable: true
 		}).open();
 	}

 

It is a part of a code that displays a small on-page window. However, within that code I want to have a form that posts $('demo1title').value as a hidden value. Any idea how to do this?

Link to comment
https://forums.phpfreaks.com/topic/221765-having-a-form-within-a-function/
Share on other sites

From what I can tell looking at the documentation (this is it right?), the content proper just contains the HTML you want to show. Pass the form's HTML to that and you should be able to create the form? Unless I'm misunderstanding what it is you're trying to do?

Ah,

I tried this, but it doesn't work:

function termsFunction() {
  		box = new LightFace({ 
 			title: 'Terms and conditions', 
			width: 400,
			height: 300,
  			content: " <form method="post" id="start" action="postback.php">
                <input type="hidden" name="postbackto" value="<? echo $friendshares['byuser']; ?>">
                <input type="hidden" name="postbackfrom" value="<? echo $friendshares['person']; ?>">
                <INPUT NAME="post" TYPE="submit" class="submit" value="That's nice"  ALT="like">
                </form>",
 			buttons: [
				{ 
					title: 'I Agree', 
					event: function() {  
						box.fade(0.5);
		 				var confirm = new LightFace({
		 					width: 200,
		 					title: 'Confirm',
							keys: {
								esc: function() { this.close(); box.unfade(); }
							},
		 					content: 'Do you agree?',
							buttons: [
								{ title: 'Yes', event: function() { this.close(); box.close(); }, color: 'green' },
								{ title: 'No', event: function() { this.close(); box.unfade(); } }
							]
		 				});
		 				confirm.open();
					},
					color: 'blue'
				},
				{
					title: 'Close',
					event: function() { this.close(); }
				}
			]
 		});
 		box.open();		
 	}

Any ideas?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.