How can I dynamically load content into a b:select instead of from an xml file?

I wrote a piece of software some months back using backbase 3.3 and I made use of b:select which got it's content from an xml file that was created by another php code.

Now fast forward to today, my boss decides he wants to make the code public (as in no longer designated to his laptop) and hence I have to save the software on two servers (of which one is the backup).

Now the problem I have is that my php code has to create dynamic content for b:select as opposed what I had before where b:select read the content from the generated xml files.

So how do I do this?

Your answers will be very much welcomed.

Thanks in advance.

Can someone please help me

Can someone please help me out?

XML generated by PHP

Hi bigdoe2000,

sry but i not really understand what your problem is. But i hope the following examples can help u:

dynamic data in the pim demo using php and mysql

remote dataSource PHP example

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ It is not enough to be Hungarian; you must have talent as well
~ Alexander Korda
~

My problem is trying to get

My problem is trying to get data from a database using a php script and then passing that data to b:select to output the data to the users.

My code is given below, what am I doing wrong?

Delete.php:

        <?php
                // Connection is openned to oracle database
                $connection = OCILogon("smarts", "smarts", "65.52.5.333:8234/adbt.es.com");
                if (!$connection)
                {
                        echo "Unable to connect: " . var_dump(OCIError());
                        die();
                }

                // Get what needs to be done
                $statements = OCIParse($connection, "SELECT ID, CUSTOMERNAME FROM SMARTS.TRANSPONDERLOADINGDATA ORDER BY CUSTOMERNAME");
                OCIExecute($statements, OCI_DEFAULT);
                $nrows = OCIFetchstatement($statements, $results);
                if ($nrows >
0)
                {      
                        echo '<?xml version="1.0" ?><div style="height:100%;position:relative;padding:1px;" xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/b" xmlns:s="http://www.backbase.com/s">';
                        echo '<b:select b:name="customerName" b:width="60%">';
                        for ($i = 0; $i < $nrows; $i++)
                        {
                                $id = $results['ID'][$i];
                                $customerName = $results['CUSTOMERNAME'][$i];
                                echo '<b:option b:value="'.$customerName.'@'.$id.'" >
'.$customerName.'</b:option>';
                        }
                        echo '</b:select>';
                        echo '</div>';
                }
                else
                {
                        echo "Sorry there are no customers to update at this time.";
                }


                OCIFreeStatement($statements);

                //log off
                OCILogoff($connection);
        ?>

here is the Code for Delete.xml:

<?xml version="1.0" ?>
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/b" xmlns:s="http://www.backbase.com/s">
                <div class="stepHeader"><b>Delete Customer Information </b></div>
                <div class="label"><i>Which Customer?</i></div>
                <br/>
                        <form action="transponderData/Delete2.php" b:destination="." method="post" b:behavior="form">
                                Choose from this list below
                                        <s:execute>
                                                <s:task b:action="load" b:url="transponderData/Delete.php" b:destination="." />
                                        </s:execute>
                                <br/>
                                <p>
                                        <b:button b:action="submit" b:target="ancestor::form[1]">SEND</b:button>
                                </p>
                        </form>        
</div>

Looks fine. What's the exact problem?

On the face of it your code looks fine. What actually goes wrong?
You described your objective, showed your code, and say you have some unspecified problem so its hard to help just yet...

* What does the generated XML look like?
* If you paste that XML by hand into your application, does it work fine?
* if so, are you able to s:load the contents successfully

Right now the xml is showing

Right now the xml is showing up in the b:select but underneath the submit button (in IE, in Firefox its givin me an error message and not displaying anything). I do not know how to get the b:select element to be above the submit button. Please help

thanks.

If you need more description from me let me know so I can add them to this post

mode defaults to appendChild

I think I see the problem. Your s:execute has a destination of "." which in this case means the form itself.
The mode defaults to appendChild so the select is appended to the form (at the bottom).
What you want is to load the contents with a mode of firstChild (check the reference for the exact spelling of the mode name).
That will place it first, above your introductory text, so not quite what you need.
Two options:
1. the easy way - put the intro text into the PHP script also and keep mode asfirstchild
2. another way - place the intro text inside a span, and place the s:execute inside the span too; that makes XPath "." refer to the span and load the contents with a mode of 'after', meaning the contents will be loaded after the span.
3. a better way - add a div or span with an class on it eg.

<span class="choices" />

and load the contents with a destination of "../span[@class='choices']" and a mode of 'replaceChildren'

I took your advices and I

I took your advices and I used the code below but the b:select content always replaces the form's submit button.

Please what can I do, I am really confused.

<?xml version="1.0" ?>
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/b" xmlns:s="http://www.backbase.com/s">
                <div class="stepHeader"><b>Delete Customer Information </b></div>
                <div class="label"><i>Which Customer?</i></div>
                        <form action="transponderData/Delete2.php" b:destination="." method="post" b:behavior="form">
                                <div class="label">Choose from this list below<div class="form-field">
                                        <span id="choices" />
                                                <s:execute>
                                                        <s:task b:action="load" b:url="transponderData/Delete.php" b:destination="*/../span" b:mode="replacechildren"/>          
                                                </s:execute>
                                </div></div>
                                <br/>
                                <p>
                                        <b:button b:action="submit" b:target="ancestor::form[1]">SEND</b:button>
                                </p>
                        </form>        
</div>

You're not alone :-)

Please help me understand what are you trying to achieve here.
I thought you wanted to load some choices into a combobox?
Do we need the form?
Have you considered an s:handler on a b:select instead of the s:execute? It might help make everything easier because then the b:select will be the XPath "."

Ok this is what I am trying

Ok this is what I am trying to do.

If you look at the php file in the previous post you will see that I am echoing the b:select content I get from a database to the form by means of the s:execute which loads up the php file.

I am basically trying to dynamically load the content from the database into the b:select construct so that my user can choose an option and then click on the submit button to move to the next page or function.

Note I am using backbase 3_3 so please respond in a way that such is possible with this version.

THanks

P.S I am looking forward to your reply, I hope I have been very clear now?

What happens if you move the

What happens if you move the s:execute after the form and use destination="id('choices')" ?

I have not tried that yet

I have not tried that yet but let me see if I get you correctly, I have made posted the code to what I think you are suggesting, if this is the case let me know so I can upload my code to see how it works

<?xml version="1.0" ?>
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/b" xmlns:s="http://www.backbase.com/s">
                <div class="stepHeader"><b>Delete Customer Information </b></div>
                <div class="label"><i>Which Customer?</i></div>
                        <form action="transponderData/Delete2.php" b:destination="." method="post" b:behavior="form">
                                <div class="label">Choose from this list below<div class="form-field">
                                        <span id="choices" />
                                </div></div>
                                <br/>
                                <p>
                                        <b:button b:action="submit" b:target="ancestor::form[1]">SEND</b:button>
                                </p>
                        </form>
                <s:execute>
                        <s:task b:action="load" b:url="transponderData/Delete.php" b:destination="id('choices')" b:mode="replacechildren"/>          
                </s:execute>
</div>

Is this what you are suggesting?

That's right.

That's right.

I will try it when I get to

I will try it when I get to work in the morning and if it works great (I am hoping it does) but if not I will be back for more of your wisdom.

Thanks for everything so far.
(Keeping my fingers crossed)

I forgot to ask two

I forgot to ask two important questions

1) what will the b:mode be for the s:execute now that it is placed out side of the form code?

and 2)what will the b:destination and b:mode for the form be?

or will it just be the same as I have it in the code example in my last post

destination and mode

Hi bigdoe2000,

1. The b:mode in the s:execute will be used to specify how the node or context will be placed in the DOM Tree. Based on the code you gave, it will actually targetting specific Node. In this case, it will target the node which has id="choices" and replace the children of the target node with the new loaded node or context.

<s:task b:action="load" b:url="transponderData/Delete.php" b:destination="id('choices')" b:mode="replacechildren"/>  

2. The b:destination for the form is used for the destination or target node of the response when the form is submitted. If it is not defined, the whole page will be refreshed with the content of the response. The global concept of the b:mode here is the same as the b:mode in s:execute. It is used to specify how the submission result is placed in the DOM Tree.

Hope this clear enough

Well your suggestions did

Well your suggestions did not work, I was able to make use of this code to get it to work

<?xml version="1.0" ?>
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/b" xmlns:s="http://www.backbase.com/s">
                <div class="stepHeader"><b>Delete Customer Information </b></div>
                <div class="label"><i>Which Customer?</i></div>
                <br/><div class="label"><b>
                                <s:execute>
                                        <s:task b:action="load" b:url="transponderData/Delete.php" b:destination="id('main1')" />
                                        <s:render b:destination="id('main2')" >
                                                <p>
                                                        <b:button b:action="submit" b:target="ancestor::form[1]">SEND</b:button>
                                                </p>
                                        </s:render>              
                                </s:execute></b></div>
                        <form action="transponderData/Delete2.php" b:destination="." method="post" b:behavior="form">
                                <div class="label">Choose from this list below<div class="form-field">
                                        <div id="main1" />
                                        <div id="main2" />
                                </div></div>
                        </form>        
</div>

But now I have a new problem:

The SEND button displays just underneath the b:select drop down menu in Mozilla but in IE it shows up way way at the button of the screen.

So how can one correct this issue with IE

Thanks and looking forward to your reply.

Did you see my last post?

Did you see my last post? What do I do to make the Send button on IE appear where I really want it?

What about putting the Send

What about putting the Send button into your delete.php generated content?