Jump to content

_IEFormElementSetValue set ok but not display on text area


Recommended Posts

this is code of text area

<div class="controlbar" style="padding-right: 8px;">
    <fieldset style="border: 0px none; margin: 0px; padding: 0px;">
    
    <textarea name="message" id="vB_Editor_QR_textarea" rows="10" cols="60" style="width: 100%; height: 100px; display: none;" tabindex="1" dir="ltr"></textarea>
    
    <iframe style="border: 2px inset; width: 100%; height: 100px;" tabindex="1" id="vB_Editor_QR_iframe"></iframe></fieldset>
    <!--width:540px-->
</div>

<input name="wysiwyg" id="vB_Editor_QR_mode" value="1" type="hidden">
<input name="styleid" value="0" type="hidden">

<script type="text/javascript">
<!--
vB_Editor['vB_Editor_QR'] = new vB_Text_Editor('vB_Editor_QR', 1, '73', '1');
var QR_EditorID = 'vB_Editor_QR';
//-->
</script>
    </div>

                    <fieldset class="fieldset" style="margin: 3px 0px 0px;">
                        <legend>Tùy Chọn</legend>
                        <div style="padding: 3px;">
                            
                                <div style="float: right;"><label for="cb_signature"><input name="signature" value="1" id="cb_signature" tabindex="5" checked="checked" type="checkbox">kèm theo chữ ký</label></div>
                            
                            <label for="qr_quickreply"><input disabled="disabled" name="quickreply" value="1" id="qr_quickreply" accesskey="w" tabindex="4" type="checkbox">kèm theo trích dẫn của bài trên.</label>

                        </div>
                    </fieldset>
                </div>
            </div>

            <div style="margin-top: 6px;">
                <input name="fromquickreply" value="1" type="hidden">
                <input name="s" value="" type="hidden">
                <input name="securitytoken" value="1244648084-dd0228cdf9a50dc53f0bac75edb778bf33ec1f35" type="hidden">

                <input name="do" value="postreply" type="hidden">
                <input name="t" value="959598" id="qr_threadid" type="hidden">
                <input name="p" value="who cares" id="qr_postid" type="hidden">
                <input name="parseurl" value="1" type="hidden">
                <input name="loggedinuser" value="100113420" type="hidden">
                <input class="button" value="Gởi Trả Lời" accesskey="s" title="(Alt + S)" name="sbutton" tabindex="2" id="qr_submit" onclick="clickedelm = this.value" type="submit">
                <input class="button" value="Nâng cao" accesskey="x" title="(Alt + X)" name="preview" tabindex="3" id="qr_preview" onclick="clickedelm = this.value" type="submit">
            </div>

http://www.5giay.vn

#include <IE.au3>

$oIE = _IECreate ("http://www.5giay.vn/showthread.php?p=18959425#post18959425")
$oForm = _IEFormGetObjByName ($oIE, "vbform")
    $oText = _IEFormElementGetObjByName ($oForm, "message")
    _IEFormElementSetValue ($oText, '2134234243243243243243243243243243243243243243242432432432432432')
    $oText=_IEFormElementGetValue ( $oText )
    MsgBox(0,"",$oText)

when i set message ok but it not display in text area

anybody answer how to set value for message ? thank

Link to comment
Share on other sites

#include <IE.au3>

$oIE = _IECreate ("http://www.5giay.vn/showthread.php?p=18959425#post18959425")
$oForm = _IEFormGetObjByName ($oIE, "vbform")
    $oText = _IEFormElementGetObjByName ($oForm, "message")
    _IEFormElementSetValue ($oText, '2134234243243243243243243243243243243243243243242432432432432432')
    $oText=_IEFormElementGetValue ( $oText )
    MsgBox(0,"",$oText)

when i set message ok but it not display in text area

anybody answer how to set value for message ? thank

Use _IEFormElementSetValue() for an INPUT tag. You may have set .value = your text, but that is not what gets displayed on a text element. Try setting $oText.innerText by way of _IEPropertySet().

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Use _IEFormElementSetValue() for an INPUT tag. You may have set .value = your text, but that is not what gets displayed on a text element. Try setting $oText.innerText by way of _IEPropertySet().

:D

Well, no... _IEFormElementSetValue is exactly what you want to use here. On Buttons, Radios, Checkboxes and Selects it may not do what you expect, but on text and text area it does just what you want.

Figure out what is different in your page compared to this example (and make certain to watch the SciTe console for messages):

#include <IE.au3>

$oIE = _IE_Example("form")
$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample")
_IEFormElementSetValue($oTextArea, "This is a Test!!!!")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Well, no... _IEFormElementSetValue is exactly what you want to use here. On Buttons, Radios, Checkboxes and Selects it may not do what you expect, but on text and text area it does just what you want.

I would stand corrected, except then I couldn't reach the keyboard, so...

I sit corrected.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Well, no... _IEFormElementSetValue is exactly what you want to use here. On Buttons, Radios, Checkboxes and Selects it may not do what you expect, but on text and text area it does just what you want.

Figure out what is different in your page compared to this example (and make certain to watch the SciTe console for messages):

#include <IE.au3>

$oIE = _IE_Example("form")
$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample")
_IEFormElementSetValue($oTextArea, "This is a Test!!!!")

Dale

my code run ok, set value ok, but value not display in text area

i'll try the PsaltyDS's way

Link to comment
Share on other sites

I presume you know what the SciTe console is? If there are no related errors or warnings displayed there, then it really is setting the displaytext in the specified element. You are likely then being fooled by 1) having more than one element with the name "message" or 2) perhaps by a frame or an iFrame or, 3) my guess, what you think is a textarea is really that iFrame you have there that is being treated as though it were a text area.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 2 weeks later...

All the above will not work because textarea use frame so you must use _IEFrameGetCollection to get collection of frames in that page then only can use _IEBodyWriteHTML to write to it.

#include <IE.au3>
$oIE = _IECreate("http://www.5giay.vn/showthread.php?p=18959425#post18959425")
$oForm = _IEFormGetObjByName ($oIE, "vbform")
$oFrame = _IEFrameGetCollection($oForm,0) ; 0 because in that page only has 1 frame
_IEBodyWriteHTML($oFrame,"test cai nao :D ")

I'm sure it will work well :D

Edited by nguyenbason
UnderWorldVN- Just play the way you like it
Link to comment
Share on other sites

  • 5 months later...

All the above will not work because textarea use frame so you must use _IEFrameGetCollection to get collection of frames in that page then only can use _IEBodyWriteHTML to write to it.

#include <IE.au3>
$oIE = _IECreate("http://www.5giay.vn/showthread.php?p=18959425#post18959425")
$oForm = _IEFormGetObjByName ($oIE, "vbform")
$oFrame = _IEFrameGetCollection($oForm,0) ; 0 because in that page only has 1 frame
_IEBodyWriteHTML($oFrame,"test cai nao :D ")

I'm sure it will work well ;)

It word well . THanks .

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...