cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass on variables while redirecting from BSP to HTML page.

Former Member
0 Kudos

Hi all,

I have two BSP pages - BSP1, BSP2. When I click a submit button on BSP1, it should call BSP2 wherein BSP2 will work silently behind the scenes and redirect some variable values through hidden form fields to BSP1 back.

User will not see BSP2 in fact. He just deals with BSP1, but when he clicks the submit button on BSP1, it silently calls BSP2, and then BSP2 will process something behind the scenes and sends back values through hidden form fields to BSP1 by means of redirection. After redirection from BSP2 to BSP1, I am not getting the hidden fields in BSP1. From the BSP1, I am trying to get the hidden fields of BSP1 using:

Here is how my code in BSP2 (redirecting to BSP1) looks like:

<b>BSP2 : Layout:</b>

<input type="hidden" name="hf1" value="vicky">

<b>BSP2 : OnInitialization:</b>

response->redirect( url_BSP1 ).

navigation->response_complete( ).

But when I am doing this, the hidden form fields from BSP2 are not being passed to BSP1 back.

I am trying to get the form values <b>in BSP1</b> as below:

<b>BSP1 : Layout:</b>

<%

data: hfield type string.

hfield = request->get_form_field('hf1').

%>

I even tried the above code in onRequest, and onInitialization sections. But I am getting nothing.

Please give me some ideas on how to deal with the redirection and get the hidden values out of that.

Thanks in advance.

Cheers,

Vicky.

Accepted Solutions (1)

Accepted Solutions (1)

eddy_declercq
Active Contributor
0 Kudos

Hi,

If you use page attributes and set them auto, you don't need to do the

data: hfield type string.

hfield = request->get_form_field('hf1').

Secondly, redirect can also be replaced by

navigation->set_parameter( name = 'hfield' value = hf1 ).

navigation->goto_page('bsp1.htm' ).

Another option is that you use BSP2 as a popup and put the values back via JS:

opener.document.formname.hfield.value=<%=hf1.%>

Eddy

Former Member
0 Kudos

Hi Raja, Eddy...

thanks a lot for your info.

Raja, I tried whatever you have mentioned. I even included a page attribute with auto checked. But went in vain. If you dont mind, can you please check with a small example and send the same me back?

Eddy, I think there should be some event triggered to process the code <b>navigation->goto_page(BSP1.htm)</b>. So, in which event handler shall I put this statement? As I mentioned previously, this BSP2 is working silently behind the scenes, not visible to the user at all. So, there is no chance of using any submit button kind of stuff inside BSP2.

Thanks in advance.

Cheers,

Vicky.

eddy_declercq
Active Contributor
0 Kudos

Vicky,

Do whatever you want in BSP2 and do at the end the goto_page in the OnInitialisation event.

In the case of the popup, you should do the goto_page in the oninputprocessing, with a self submit of the form in the layout. The user will notice some movement, but it the popup is so quickly gone that one doesn't really realize what's going on. We use it a lot for a repertorium search. If the serach delivers only one result, the popup is not needed for selecting a value and the stuff is automatically filled in. The popup appears for a split of a second and is gone again.

Eddy

Former Member
0 Kudos

Hi Eddy,

thanks a lot for your helpful quick reply.

By the way, I am curious to check the pop-up option. Can you please send me some coding part about self submission ?

Cheers,

Vicky.

eddy_declercq
Active Contributor
0 Kudos

Hi,

There are different ways to do it, but let's pick this one. It closes the popup. If you need additional things to be done, you can make a form with all hidden fields, submit that form, do the same close and do whatever you need in the inputprocessing

<html>

<head>

<title>title</title>

<script language="javascript">

function init() {

<%if count eq 1.%>

opener.document.form.F<%=field%>.value = '<%=value.%>';

close();

}

<%else.%>

...

<%endif.%>

</script>

</head>

<body onLoad="init();">

</body>

</html>

Former Member
0 Kudos

Hi Eddy,

thank you for supplying the code snippet.

Vicky.

Answers (1)

Answers (1)

athavanraja
Active Contributor
0 Kudos

for a hidden form field from BSP2 to be able to passed to BSP1

BSP2page has to be submitted, or

in the redirect url you have to pass the value

response->redirect( url_BSP1?hf1=vicky ).

BSP1 should have a page attribute hf1 with auto checked.

Regards

Raja