Variables

Hello,

Ive got trouble in retrieving a variable, it seems that examples in the documents wont work on me. :D Even the example in Beginner Tutorial, it wont freaking work. I dont know why, did it work for you guys?

Take this code in the doc for example:

<?xml version="1.0"?>
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/2006/btl"
xmlns:e="http://www.backbase.com/2006/xel" xmlns:c="http://www.backbase.com/2006/command">

  <div>
    Name of your dog:
    <input type="text" id="Name" name="Name" />
  </div>
  <div>
    Age of your dog:
    <b:spinner id="Age" name="Age" value="7" step="1" min="0" max="20" width="60px" />
  </div>
  <b:button>
    <e:handler id="buttonSubmit" event="click" type="application/xml">
     <e:variable name="Name" select="(bb.getProperty(bb.getElementById('Name'),'value'))" />
     <e:variable name="Age" select="(bb.getProperty(bb.getElementById('Age'),'value'))" />
     <c:load url="form_process.php" method="GET" data="concat('Name=',$Name,'&Age=',$Age)" destination="id('right_side_content')" mode="replaceChildren" />
    </e:handler>
  Send Form
  </b:button>
</div>

It wont work for me. :( I get this error:
1: GENERIC: XML Parsing Error: not well-formed Location: http://localhost/bbase/index.php Line Number 20, Column 33: Text: data="concat('Name=',$Name,'&Age=',$Age)" destination="id('right_side_content')" --------------------------------^.

So I tried looking for a simpler example, got this at the Application Development Documentation:

<e:handler event="click" type="application/xml">
  <e:variable name="myVar" select="'value'" />
  <e:script> alert(myVar); </e:script>
</e:handler>

Bah, I will get this error: GENERIC: Javascript error: "myVar is not defined".

Can someone please help? Im stuck at this, I cant even pass my form data. :(

Renjay

Ok, I am now able to

Ok, I am now able to retrieve the values from the input through XPath. Ok, last problem, how to concatenate a variable and a string in the data attribute of c:load? Well, the current example wont work so can someone tell me how?!?

add some curly braces

<c:load url="PetShop.php" method="GET"
                                data="{concat('Name=',$Name,'&amp;Age=',$Age)}"
                                destination="id('right_side_content')" mode="replaceChildren" />

Can you show me your XPath variable retrieval?

Regards,

Jan

Thanks Men! I havent thought

Thanks Men! I havent thought of that. Here's how i got the value through XPath.

<e:variable name="Name" select="id('Name')/property::value" />