Jump to content

var in a webpage(html form textarea VALUE - yui) that contains html code, and want to appear it, in confirmformpage.php


lse123

Recommended Posts

If I have a javascript var in a webpage(html form textarea VALUE - yui) that contains html code, and want to appear it, in confirmformpage.php, then how to transfer it...? is it really needed go via PHP ...? and ofcourse use innerHTML to write it....yesI usually use an intermitened processform.php script.http://developer.yahoo.com/yui/editor

Link to comment
Share on other sites

If you want to save the value so that it always shows on the page, then yeah you need to use a language like PHP which can save it. If you only want to display it on the current page you're viewing but not have it saved for anyone else looking at that page, then you can just use Javascript to modify the page. All Javascript does is modify the current page, it doesn't save anything.

Link to comment
Share on other sites

look athttp://www.paphoscarhire.mobi/Reciprocals/...editor/book.phpnames are not matter and may not be real,only webform matters...confirmformpage.php appears confirmation on screen and , itself ALL page, goes via email to site owner and visitor...I want textarea html code formatted data, transmitted with email and shown on screen. this with php...

Link to comment
Share on other sites

I want textarea html code formatted data, transmitted with email in a message and shown on screen in confirm page. this with php... I mean transfer html code to confirm page as 'appeared data'(how?), and then trasmit all confirm page via email, in the body of email with php?

Link to comment
Share on other sites

fromhttp://developer.yahoo.com/yui/editor/if have a js var: html how assign in php var $htmlEq AND after APPEAR ITS CONTENTS TO NEXT .php PAGE?Getting the data from the EditorThere are a couple of ways to get the data from the editor. The first way is to let the Editor do it for you by setting the handleSubmit configuration option.Setting the handleSubmit configuration option, the Editor will attempt to attach itself to its parent form's submit event. Then it will call its saveHTML method, then proceed with the form submission.The manual way, is to call the saveHTML method yourself. Like this:view plain | print | toggle line numbersvar myEditor = new YAHOO.widget.Editor('msgpost');myEditor.render(); //Inside an event handler after the Editor is renderedYAHOO.util.Event.on('somebutton', 'click', function() { //Put the HTML back into the text area myEditor.saveHTML(); //The var html will now have the contents of the textarea var html = myEditor.get('element').value;}); var myEditor = new YAHOO.widget.Editor('msgpost');myEditor.render();//Inside an event handler after the Editor is renderedYAHOO.util.Event.on('somebutton', 'click', function() {//Put the HTML back into the text areamyEditor.saveHTML();//The var html will now have the contents of the textareavar html = myEditor.get('element').value;});

Link to comment
Share on other sites

You can either submit a form or use ajax to send the value to PHP, and you can save it in the session to make it available on other pages.
GIVEN JS VAR GET IT'S VALUE ONSUBMIT, then may use ajax [js1+php1 files] to save var in session onsubmit, and form actually submitted thereafter on [php2 file] using the prior php session var from ajax?
Link to comment
Share on other sites

I mean JS VAR GET IT'S VALUE ONSUBMIT(just after press submit, correct?), then may use ajax [1.js+1.php files] to save var in session onsubmit, and form actually submitted thereafter continuously, on [2.php file] using the prior php session var setup from ajax/1.php files?

Link to comment
Share on other sites

You can set a value of a Javascript variable however you want. You can do that in the form's submit handler, or at any other time. No matter how you set the value, if you want to send the value to PHP without the page refreshing then you need to use ajax. If you don't care if the page refreshes, then you can just submit the value through a regular HTML form. Regardless of how the data gets to PHP, once PHP has the value you can save it in the session, and then that value will be available to PHP on any other page in the session.

Link to comment
Share on other sites

  • 2 months later...
You put the value into a regular form input element. If you don't want the value to appear in the form, you can use a hidden input element.
yes but in this case var get it's value AFTER press the submit and wanted appeared same time with php..., how do that you say???
Link to comment
Share on other sites

yes but in this case var get it's value AFTER press the submit and wanted appeared same time with php..., how do that you say???
if you need to perform calculations with form data after its been submitted, then the PHP page the form is submitting to can handle that as well.
Link to comment
Share on other sites

if you need to perform calculations with form data after its been submitted, then the PHP page the form is submitting to can handle that as well.
yes but in this case variable of rich textarea content get it's value AFTER press the submit[how then insert in a hidden field], and wanted appeared same time with php...in next page, how do that you say???
Link to comment
Share on other sites

yes but in this case variable of rich textarea content get it's value AFTER press the submit[how then insert in a hidden field], and wanted appeared same time with php...in next page, how do that you say???
If the content is in a textarea, the textarea's value should be submitted along with the rest of the form. There's no need to store it's contents in a variable.
Link to comment
Share on other sites

<input type="hidden" id="hidden_id" name="hidden_name">In the onsubmit handler:document.getElementById("hidden_id").value = 'whatever value you want';It doesn't matter what the variable is. It doesn't matter if it contains rich textarea content or anything else. It doesn't matter if the value gets set before or after any other event. All you need to do is access the element, however you want to do that, I used document.getElementById above, and set the value to whatever you want to set it to. When the form submits it will include the hidden input.

Link to comment
Share on other sites

in Post #10: var html = myEditor.get('element').value; // relative to this assign document.getElementById("hidden_id").value = html; // but in what place the latter statement? I have to download yahoo ui lib or the use of online (from yahoo directly=absolute url) is ok???

Link to comment
Share on other sites

in Post #10: var html = myEditor.get('element').value; // relative to this assign document.getElementById("hidden_id").value = html; // but in what place the latter statement?
You assign the value to the hidden element wherever you want to do that. I'm not real sure how to say that. The correct place where you assign the value is the point at which you want to assign it. Post 10 shows an example of putting a handler on a button, if that's what you want to do then you can assign the value then. You just assign the value whenever you want the hidden input to get that value.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...