Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a HTML Custom View of a Form Template with the + Icon working 1

Status
Not open for further replies.

bobbigmac

Programmer
Jun 2, 2005
8
0
0
GB
Hi

I'm trying to create a custom view of a form template using HTML. The view can be created and restyled as much as I like fine.

I have a number of fields in the Form template which are unlocked (So have the + icon next to them) however once the form is created from the template with the custom view applied, the + button no longer works. Does anyone have a workaround for this?

Thanks
Bob
 
If you look at the page source you can see that the + sign thing actually is javascript with submissions to the livelink server involving postback from the livelink server.

For eg if your form field is called
[LL_LOOP_BEGIN_1_1_28 /]
[LL_FormTag_1_1_28 /]
[LL_LOOP_BEGIN_1_1_28 /]

When the custom view loads first time one of the filedls will be loaded for eg LL_FormTag_1_1_28_1

Whn you click the + sign you can see it has javascript like
<!-- End File: webattribute/attrstring.html -->
<A HREF="javascript:addRowSubmit( '_1_1_29', '2' )"><IMG SRC="[LL_SupportPath /]add-row.gif" WIDTH="16" HEIGHT="16" ALT="Add Value" BORDER="0"></A>
<A HREF="javascript:delRowSubmit( '_1_1_28', 'Delete this value?' )"><IMG SRC="[LL_SUPPORTPATH /]delete-row.gif" WIDTH="16" HEIGHT="16" ALT="Delete Value" BORDER="0"></A>

As it is evident it needs to call addrowsubmit which hits the livelink server and builds the form with another input field this time LL_FormTag_1_1_28_1 and so on .So first check if you have some mechanisms built so you have not allowed a form submit.Perhaps you have a valaidation javascript that is not allowing a form submit.

Typically before we submit we would have done some client javascript validation and that may be killing it.

Also here's how we handle the MVA row submit and the real form submit.

in the button to submit you would have a simple javascript routine like
<INPUT CLASS="applyButton" TYPE="BUTTON" VALUE="Submit" NAME="IgnoreMe" ONCLICK="doSubmit( document.myForm );"> ,as you can see the form will really submit only after hitting my js func doSubmit.So this will break the MVA(multi variable attribute the +,minus stuff)

To get around it look for the OT javascript function like this
Code:
function addRowSubmit( fieldName, index )
{

	ClearCookies = false

	document.myForm.func.value = 'webform.AttrValueAdd';
	document.myForm.LL_AttrFieldName.value = fieldName;
	document.myForm.LL_AttrFieldIndex.value = index;
//Custom code so that user can use the MVA we use document cookies so that even though the form relaoded we can still preseve the values
	//before submiting the form, I have to enable all of the fields or else they don't get submitted!
	enable_all_inputs()

	document.myForm.submit();

	//Set the cookie to remember the tab the user last selected!
	createCookie("SelectedTab",currentTab,0)
	}

As you can see the form is submitted to the llserver which then builds the second row and so on.Also you can see I am trying to preseve state by using clinet cookies as well





Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
also you can remove the livelink support directory hard code

by using this
Code:
="[LL_SupportPath /]add-row.gif"

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
this ,enable_all_inputs()
and createCookie are all custom javascript that we have developed for our situation.They don'tcome from OT.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Hi Appnair

Thanks for your post, however I'm afraid it's maybe a little over my head.

The only things I've modified in the custom view (as compared to the file generated when you click 'Export as HTML' from the Form Template) is the layout. I've not changed any javascript, or object names, or anything. I've checked I've not changed any of these accidentally and it seems ok. Do you mean I need to write some javascript to get the + working, or remove some existing code?

Thanks very much.
Bob
 
No when you do export as html OT supplies the minimum javascript to get all these working.I have noticed problems happen,why do you export as html.it is to aesthetize beautify the form ,align and put things in the way a user wants to see it correct.If you see certain WYSIWYG editors it introduces characters that sometimes tend to break what OT wants in thir forms.So with a rudimentary knowledge ogf html and javascript you can do wonders with the view.Having learnt the hard ways,I only use a text editor like textpad,notepad or wordpad to touch my form view.

A simple test will be export as html of the form,add that to your template as a form view,call it untouched_form_view.html or something and add it back to the template,update the template and see if your (+) works.That will tell you whether or not your editing broke it or not.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Hi

I tried exporting as html, not modifying, then adding it as a View to the template, (untouched_*) and the + still fails to work. Any idea what may be happening here?

Thanks
Bob
 
You are right I do not know if it is a bug or not.Heres some stuff that I think will help you.Find one of your input fields that has a plus sign let's call it

Code:
<TD NOWRAP>
<!-- File: webattribute/attrstring.html -->
<LABEL FOR="_1_1_2_1"></LABEL>
<INPUT CLASS="valueEditable" TYPE="text" NAME="_1_1_2_1" ID="_1_1_2_1" VALUE="[LL_FormTag_1_1_2_1 /]" SIZE="32" MAXLENGTH="32" ONFOCUS="" ONCHANGE="markDirty();">
<!-- End File: webattribute/attrstring.html -->
<A HREF="javascript:addRowSubmit( '_1_1_2', '2' )"><IMG SRC="/HOULivelinkTestsupport/add-row.gif" WIDTH="16" HEIGHT="16" ALT="Add Value" BORDER="0"></A>
</TD>

Let's try to make it work.If you look carefully what is being done here is changing
ID="_1_1_2_1" to ID="_1_1_2".When the loop runs livelink will create input field id's 1,2, and 3.I am guessing it makes sense to you.the spacing and the numbers are pretty much important.


Code:
[LL_LOOP_BEGIN_1_1_2 /]
<TD NOWRAP>
<!-- File: webattribute/attrstring.html -->
<LABEL FOR="_1_1_2_1"></LABEL>
<INPUT CLASS="valueEditable" TYPE="text" NAME="_1_1_2" ID="_1_1_2" VALUE="[LL_FormTag_1_1_2 /]" SIZE="32" MAXLENGTH="32" ONFOCUS="" ONCHANGE="markDirty();">
<!-- End File: webattribute/attrstring.html -->
<A HREF="javascript:addRowSubmit( '_1_1_2', '2' )"><IMG SRC="[LL_SUPPORTPATH /]add-row.gif" WIDTH="16" HEIGHT="16" ALT="Add Value" BORDER="0"></A>
<A HREF="javascript:delRowSubmit( '_1_1_2', 'Delete this value?' )"><IMG SRC="[LL_SUPPORTPATH /]delete-row.gif" WIDTH="16" HEIGHT="16" ALT="Delete Value" BORDER="0"></A>
</TD>

[LL_LOOP_END_1_1_2 /]


I hope this will help you with it and probably ask Ot if this is a bug or not.I just got this to work on a 9.5 sp1 system.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top