Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Prefill in include_form.html

Quote Reply
Prefill in include_form.html
Simple HTML question that's bothering the heck out of me...

As you know, the include_form.html template is used by both the add.html and the modify.html templates. The various data fields are checked with an %if% function to determine if data exists, and if the data does exist, the fields are prefilled. Fine.

Radio buttons, checkboxes, and pull-down menus use a different syntax to determine values, however, and while I know how to set defaults on those fields, I don't know how to utilize the %if% function to preload these special fields with the correct existing data, so that a user modifying his/her record doesn't accidentally turn off a value that was previously turned on.

Can someone give me the statement I would need to use to preload non-text fields in the include_form template?

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Prefill in include_form.html In reply to
It all depends on how you have the fields setup. If it was a "Yes/No" SELECT option, then you could use;

<%if FieldName eq "value"%>selected<%endif%>

...if it was a checkbox;

<%if FieldName eq "Yes"%>checked<%endif%>

In regards to SELECT dropdowns (which are **NOT** fun to code manually into the HTML :p), you may want to give this a go;

http://www.sqlwidgets.com/...ces/Detailed/16.html

It basically generates the fields for you, and "selects" the appropriate value (if they have selected something from a previous step). Thanks to Laura for this global Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Prefill in include_form.html In reply to
Thanks, Andy, this clears things right up (at least for the first two parts, I'll have to take a look at the third)!

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [Andy] Prefill in include_form.html In reply to
I'm returning to the question with a related concern:

I notice that the field used to upload an image remains empty when the include_form template it resides on is called by Modify. Because it is empty, the image goes away.

This field doesn't want to behave like the other fields, possibly due to its unusual nature. Can anyone share the trick that allows a user to upload an image in Add or Modify, but not be required to upload an image every time Modify is applied?

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Prefill in include_form.html In reply to
Yeah, unfortunatly there isn't really a way to "re-add" the value for that field. i.e you can't just do;

<input type="file" name="Image1" <%if Image1%>value="<%Image1%>"<%endif%>>

This has been a PITA for a long time (and isn't really anything to do with GT/LSQL, as its a browser based issue :().

Quote:
but not be required to upload an image every time Modify is applied?

GT::SQL::File handles this for you. Basically, when modifying a link ... if you DON'T enter a new value, e.g Image1, then the image won't be deleted.

However, if someone submits a new image/file, then the old one is removed, and the new one is uploaded.

Pretty cool stuff :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Prefill in include_form.html In reply to
Does that mean that if I do use

<input type="file" name="Image1" <%if Image1%>value="<%Image1%>"<%endif%>>

the program thinks I'm inputting a new file and deletes the old one? I ask because it appears to be doing just that! Should I simply use

<input type="file" name="Image1" >

without a value statement?




Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Prefill in include_form.html In reply to
Quote:
Should I simply use

<input type="file" name="Image1" >

without a value statement?

Yup :)

It shouldn't delete the file then, as its assuming no change has been made (similarly to how given fields are only modified if you remove a value/change the value of it. Pretty cool Cool

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!