1

I have a button on a form that I use to commit the data and then redirect to another page.

What I am hoping to have is to be able to redirect to different pages based on the value of a type field.

Right now everything goes to one page using:

<input type="button" class="ms-ButtonHeightWidth" value="Resubmit" name="btnResubmit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={https://redirected_pageA.aspx}')}"/>

What I would like is something like:

If FieldType='A' then

    <input type="button" class="ms-ButtonHeightWidth" value="Resubmit" name="btnResubmit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={https://redirected_pageA.aspx}')}"/>

else if FieldType="B" then

    <input type="button" class="ms-ButtonHeightWidth" value="Resubmit" name="btnResubmit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={https://redirected_pageB.aspx}')}"/>

else if FieldType="C" then

    <input type="button" class="ms-ButtonHeightWidth" value="Resubmit" name="btnResubmit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={https://redirected_pageC.aspx}')}"/>

Endif

Can anyone help me to get this end logic? I am using Sharepoint Designer 2007.

Thanks in advance

  • George, please share the button html code - this can be done by calling some JavaScript... – Arsalan Adam Khatri Nov 6 '12 at 12:22
  • Sorry Arsalan... I had pasted it in but hadn't noticed that it didn't come across. Here it is...<input type="button" class="ms-ButtonHeightWidth" value="Resubmit" name="btnResubmit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={page_a.aspx}')}"/> – George Nov 6 '12 at 13:19
0

George,

Jim Bob Howard has wonderful article series on DataViewWebParts and here is what you are looking for:

Extending the DVWP: Passing XSL Variables to Javascript, in this article look into "Dynamic Querystring in a Redirect" section...

So you will write something like this in your click event:

if($FieldType == 'A') { ddwrt:GenFireServerEvent('__commit;concat(__redirect={https://redirected_pageA.aspx}') } else if ($FieldType == 'B') { ddwrt:GenFireServerEvent('__commit;concat(__redirect={https://redirected_pageB.aspx}') }

Or simply have a look at First Feedback on this article

I hope this will work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.