Solved

HOW TO READ DATA FROM HTML HIDDEN FIELD

Posted on 2001-06-16
13
251 Views
Last Modified: 2013-11-20
Hi Experts,
I wrote an html file through CHtmlView support from appwizard application in vc++6. I have added
 a hidden field to the html document. I wrote some data using IHTMLInputHiddenElement interfaces
putvalue() method it takes BSTR data type as an argument.In my html document i gave path to
 iis4.0 asp server in my post(action ) method in my form.
      I am unable to write the data from the hidden field in to a file through my asp program.
Actually i am successfull in writing normal data to a file but problem arises when the data's
value is exceeding  256.
     I can retrieve data from the html document through my vc++ program and write it successfully
but i am failing to do through asp.
0
Comment
Question by:PSRISAIHARI
  • 5
  • 3
  • 3
  • +2
13 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6201050
Show the code that is failing and decsribe any error messages and so forth that you see when it fails.

-- Dan
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6201515
if you want to read what is in an hidden field from asp you can use the Request object and the QueryString method.

Also is the hidden field wrapped by the form you are submitting - I can't remember if that is important
0
 

Author Comment

by:PSRISAIHARI
ID: 6205094
Hi ShaunWalde and DanRollins
I wrote an html file through CHtmlView support from appwizard application in vc++6. I have added
 a hidden field to the html document. I wrote some data using IHTMLInputHiddenElement interfaces
putvalue() method it takes BSTR data type as an argument.In my html document i gave path to
 iis4.0 asp server in my post(action ) method in my form.
      I am unable to write the data from the hidden field in to a file through my asp program.
Actually i am successfull in writing normal data to a file but problem arises when the data's
value is exceeding  256.
     I can retrieve data from the html document through my vc++ program and write it successfully
but i am failing to do through asp.
      In Asp the code is like this
 data = request.form("hiddenStringName")
Set Object=Server.CreateObject ("Scripting.fileSystemObject")
set myWriteFile=Object.OpenTextFile("filepath",8,true)
myWriteFile.WriteLine(data)
   But what the data is being written into the file is different when compared to data which i wrote through my
vc++ program using WriteFile.
   The difference is in the data where the value is greater
than 256

 


   
 
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 49

Expert Comment

by:DanRollins
ID: 6211422
The phrase "greater than 256" is ambiguous.  Please show an example of data that works and an example of data that does not work.  Also describe in what way it does not work (do you get nothing, do you get just a little piece of data, do you get the wrong data, etc). and post here the data that the VC++ program sent and the data that the asp recieved.

Please, do not repeat the original question.  Thanks!

-- Dan
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6211527
> greater than 256

do you mean string length ?

is it being limited by a MAXLENGTH attribute? - just guessing -

0
 

Author Comment

by:PSRISAIHARI
ID: 6213064
I get data values whose ascii values is less than 256.
For example

 unsigned short *no_ToSend;
 LPDISPATCH myDispatch;
 IHTMLDocument2 *myHtmlDocument;
 IHTMLElementCollection *myHtmlCollection ;
 IHTMLInputHiddenElement *myHtmlInputHiddenElement;    
 VARIANT myVariant,initVariant ;
 DWORD error=0;    
 no_ToSend=new unsigned short[8];


 for(i=0;i<8;i++)
   no_ToSend[i]=i+251;

      myDispatch=this->GetHtmlDocument();  //get html    document's idispatch
     if(myDispatch == NULL)
     {
          MessageBox("could not get html document");
          return;
     }          
     if((myDispatch->QueryInterface (IID_IHTMLDocument2,(void**)&myHtmlDocument))!=S_OK)//get html document interface
     {
          MessageBox("error in query interface");
          return;
     }
     if((myHtmlDocument->get_all (&myHtmlCollection))!=S_OK) // call getall method of html doc interface
     {
      MessageBox("error in get_all of myHtmlCollection");
     
 
 myVariant.vt = VT_UINT;
          myVariant.lVal = 5 + j ;
          VariantInit(&initVariant);//initializevariant before calling item method of collection

          if((myHtmlCollection->item (myVariant,initVariant,&myDispatch))!=S_OK)
          {
               MessageBox("error in htmlcollection's item method");
               return;
          }    
          if( ( error=myDispatch-> QueryInterface (IID_IHTMLInputHiddenElement,(LPVOID *)&myHtmlInputHiddenElement))!=S_OK)
          {          
               MessageBox("error in query interface of iid_ihtmlinputhiddenelement");
               return;
          }

if( (myHtmlInputHiddenElement->put_value(no_ToSend) )!= S_OK)               //myHtmlInputHiddenElement
          {
               MessageBox("error in putvalue");
               return;
          }

Now in the above through my putvalue i am sending data to
hidden field
I am successfully putting data to it
My problem is when i  retrive data through my asp program
and writing to file
The characters whose ASCII VALUE IS > THAN 256 i am not   able to write to file
My asp code is already written above
 

0
 

Author Comment

by:PSRISAIHARI
ID: 6213091
The data that its writing is <<#&65021;>> for the values whose ascii value is greater than 256.

Since the data type in vc++ is BSTR(unsigned short) i am
able to send values greater than 256.
Through my vc++ WriteFile i can write unsigned short data
to a file.
But through asp i am not able to write all the data in the
hidden field.
If at all u find simple syntax mistakes in my VC++ code i am showing please ignore it. I have no problem in my vc++
code
sai
0
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 100 total points
ID: 6213425
ah I think you are opening your file in ascii mode - change OpenTextFile to be


set myWriteFile=Object.OpenTextFile("filepath",8,true,-1)

this should open it in unicode


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6216627
There is a chance that you are getting the correct data, but that it is not being written to the file.  One quick test would be to have the asp program pop up a window with the data.

-- Dan
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6307031
hi PSRISAIHARI,
Do you have any additional questions?  Do any comments need clarification?

-- Dan
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6420399
hi PSRISAIHARI,
Do you have any additional questions?  Do any comments need clarification?

-- Dan
0
 
LVL 11

Expert Comment

by:griessh
ID: 7378743
Dear PSRISAIHARI

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "ShaunWilde"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7420188
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 130
while loop over for loop 7 101
changeXy challenge 13 81
wordappend challenge 8 172
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question