Question : Echo value from text field and print it in separate div

I have a large number of text fields in a form, each field with a unique name. I need to echo whatever value is in that field to a span of text in a separate div whenever the user click away from the field.  I need to accomplish this using javascript/Ajax and not PHP.

Answer : Echo value from text field and print it in separate div

Hi obad62,

IMO you either use the wrong string class or don't use it correctly.

If you want to use 'string' from STL you'll have to:
- include 'string' header, i.e.:
#include <string>
- prefix the 'string' with the 'std' namespace, i.e.:
std::string s[3]= ...

Or maybe you want to use a QString instead.

BTW, I didn't find a 'QPen' constructor which takes a string as first parameter.

So, IMO the attempt how you do it is wrong - instead of a string you'll either have to use an array of 'QColor's instead of strings or generate 'QColor's by passing strings from the array - I think the first one is easier.

To do so I changed the code a bit and attached it here - I hope it's mostly correct since I couldn't test it here since I have no Qt.

Hope that helps,

ZOPPO
1:
2:
3:
4:
5:
6:
7:
8:
9:
QColor s[3]={Qt::black,Qt::red,Qt::blue};
int a[3] ={60,40,120};
for(int i=0 ; i<3 ;i++){
 for(int x=6 ;x<18;x=x+6){
  QRectF rect1(x,0.0,0.0,-a[i]); //
  line.setPen(QPen(s[i],8,Qt::SolidLine,Qt::RoundCap,Qt::MiterJoin));
  line.drawRect(rect1);
 }
}
Random Solutions  
 
programming4us programming4us