Gossamer Forum
Home : Products : DBMan : Installation :

fields not loading in MODIFY

Quote Reply
fields not loading in MODIFY
I want to allow users (all of whom own just one record), to go from html_home directly to modify_form, bypassing a search. I use this link in html_home:

print qq! <A HREF="$db_script_link_url&$db_cols[$auth_user_field]=$db_userid&modify_form=1">Modify</A><p> ! if ($per_mod);

...I get the modify_form, but the fields are empty. How can I get the modify_form to include the record?

Thanks,
Rick
Quote Reply
Re: fields not loading in MODIFY In reply to
Does the modify form work correctly if you do a search first?


------------------
JPD





Quote Reply
Re: fields not loading in MODIFY In reply to
I still get no records.

Rick
Quote Reply
Re: fields not loading in MODIFY In reply to
Then you probably have accidentally deleted the line at the beginning of html_record_form--

my (%rec) = @_;

That line needs to be the very first line right after the name of the subroutine.



------------------
JPD





Quote Reply
Re: fields not loading in MODIFY In reply to
I have that line in html_record_form, as well as html_record, html_record_long, and html_modify_form_record.

Everything else works fine. I just can't get a record's fields into modify_form.

Rick

Quote Reply
Re: fields not loading in MODIFY In reply to
You shouldn't have the line

my (%rec) = @_;

in sub html_modify_form_record. It needs to be

my (%rec) = &get_record($in{'modify'});

Double check to make sure that's what you have.

------------------
JPD





Quote Reply
Re: fields not loading in MODIFY In reply to
Yep, that's what I have.

I think I probably have, as you suggested, accidentally deleted something. So, maybe you could peruse the following to see if I left anything out - -

in html_record_form, html_record_long, and html_record I have:
_________________

my (%rec) = @_;
_________________

In html_modify_form I have:
_________________

my (%rec) = &get_record($in{'modify'});
_________________

In html_add_success I have this link:
_________________

print qq|.....<A HREF="$db_script_link_url&$db_cols[$auth_user_field]=$db_userid&modify_form=1">Modify</A>
<p>|if ($per_mod); print qq|
________________

If you want to take a look at the whole thing, I put it at http://www.schoolshows.com/html_pl.txt

You also could try it by using the temporary links I've set up at: http://www.schoolshows.com/links.htm

Thanks a lot for sweating this out with me. You're my champ!

Rick
Quote Reply
Re: fields not loading in MODIFY In reply to
I was having trouble reaching your server. I'll try again later.

The only other place I can think of that would be causing this problem is in html_modify_form_record. Make sure the following is in the middle of the subroutine

&html_record_form (%rec);

I am assuming that you are getting the modify form displayed, but that all the fields are empty. Is that a correct assumption? You're not getting something else, like a search form and an error message, are you?


------------------
JPD





Quote Reply
Re: fields not loading in MODIFY In reply to
Yes, I do have &html_record_form (%rec) in modify_form_record.

And, your assumption is right - - I am getting the modify form displayed.

Rick
Quote Reply
Re: fields not loading in MODIFY In reply to
I finally got through to your server. The reason you're not getting the values in the fields is that you don't have the variables for the values defined.

For example, just one of the fields I took at random--

You have

<INPUT TYPE="text" NAME="quotesource" SIZE="35" VALUE="">

You need to have

<INPUT TYPE="text" NAME="quotesource" SIZE="35" VALUE="$rec{'quotesource'}">

You'll need to do that with all of your fields, including the hidden ones. Make sure that you have entry fields for every one of your database fields, including the hidden ones.

You're going to still have problems with the select fields, though. Instead of printing them out, you need to use

|; print &build_select_field("FieldName","$rec{'FieldName'}"); print qq|

You need to do something similar with radio fields and checkboxes.



------------------
JPD





Quote Reply
Re: fields not loading in MODIFY In reply to
Hi again,

I’ve had partial success with your solution. On modify_form_record I now get all type=TEXT fields, but I do not get any TEXTAREA fields. Here’s a sample of how I’ve defined one of these fields in html_record_form:

<TEXTAREA NAME="bio" ROWS="5" COLS="60" VALUE="$rec{'bio'}"></TEXTAREA>

Can you see what’s wrong?

Also, on radio fields, I would like to have the VALUE different from the text seen on the form. For example, I want the user to see “Green” on the form, but for the VALUE to be “#00ff80”.
Is there anyway to do this within:

|; print &build_radio_field("background","$rec{‘background’}","background",); print qq|

Thanks again for valuable help.

Rick
Quote Reply
Re: fields not loading in MODIFY In reply to
Textareas are different from text fields. This is the syntax you need to use:

<TEXTAREA NAME="bio" ROWS="5" COLS="60">$rec{'bio'}</TEXTAREA>

Regarding your radio fields, first, this was probably a typo, but just to make sure, the format is

|; print &build_radio_field("background","$rec{'background'}"); print qq|

You can't directly do what you want with the "#00ff80" and "Green" options, but you can get pretty sneaky.

Set up your radio buttons with the names of the colors. Then, in your .cfg file, add

Code:
%color_def = ( Green => '#00ff80',
Red => '#ff0000',
Blue => '#0000ff');

Include all your colors and the codes that you list in the radio field definition.

When you go to print it out in sub html_record, use

$color_def{$rec{'background'}}



------------------
JPD